multithreadin in c#, VSTO


  • I have a task to provide a button to stop running process and for that sake i am trying to use multithreading but it gave me exception on a certain point i don't understand how to deal with it please provide some solution. Here its code

    private void btngenerateNew_Click(object sender, RibbonControlEventArgs e)
            ThreadObject threadObj = new ThreadObject();
            threadObj.sender = sender;
            threadObj.e = e;
            btnGen = new Thread(supportCall);
        private void callGeneateBtn(ThreadObject threadObject)
        private void supportCall(object parameter)
            ThreadObject ob = parameter as ThreadObject;
     public string FetchSelectedProperty(string propertyType, string typeStr, ref Microsoft.Office.Interop.Word._Document document)
            string strPropValue = string.Empty;
            DocumentProperties properties;
            properties = (DocumentProperties)document.CustomDocumentProperties;
            object missing = System.Reflection.Missing.Value;

    here its throwing the exception Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.DocumentProperties'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{2DF8D04D-5BFA-101B-BDE5-00AA0044DE52}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

    Tuesday, May 26, 2015 10:40 AM