none
Exception while initializing the word application using microsoft.office.interop.word in c# (Retrieving the COM class factory for component with CLSID....) RRS feed

  • Question

  • Hi 

    I am using Microsoft.Office.Interop.Word in my WPF application to get the instance of the word, below is code snippet

    using EZI.ADTool.Log4netLogger;
    using System;
    using System.Collections.Specialized;
    using System.IO;
    using System.Text;
    using System.Threading;
    using System.Windows;
    using telerik = Telerik.Windows.Documents.Proofing;
    using wordApplication = Microsoft.Office.Interop.Word;
    
    namespace WordTestDemo
    {
        public class WordTest
        {       
            public static string GetWord()
            {
                var wordApp = new wordApplication.Application();
                //Other Code....
                //Other Code....
                //Other Code....
            }
        }
    }

    but sometimes it gives the exception.

    Exception message

    Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))

    Below is the Error trace of exception

    NameSpace : System.Runtime.Remoting ,
    Class Name : System.Runtime.Remoting.RemotingServices ,
    Method Name : AllocateUninitializedObject ,
    Exception Message : Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). ,
    Error Trace :    at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
       at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
       at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
       at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
       at System.Activator.CreateInstance(Type type, Boolean nonPublic)
       at System.Activator.CreateInstance(Type type)
       at EZI.ADTool.UI.MainApplication.SpChk.CustomDictionary.GetRegisteryKey()
       at EZI.ADTool.UI.MainApplication.SpChk.DocProofing.get_TelSpellchecker() 
    Inner Exception:  

    Please let me know the reason and possible solution for this exception.

    Thanks in advance

    Ankur R.

    Thursday, March 1, 2018 10:01 AM

All replies

  • Hi Ankur,

    >> but sometimes it gives the exception.

    When and how will it throw this exception? Could you reproduce this issue in the specific situation? While the error happening, is there any Word document opened?

    In addition, do you have any issue with thread below?

    # Font change in PPT Comment for empty bullet content

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/9503b2ac-f9cf-4451-938f-bea3c37a3b95/font-change-in-ppt-comment-for-empty-bullet-content?forum=oxmlsdk

    If not, I would suggest you share us your solution and mark the solution as answer.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 2, 2018 7:07 AM
  • HI

    I am not able to reproduce it with some well-defined steps, it comes while working on the application.

    Thanks

    Ankur 

    Sunday, March 4, 2018 7:29 PM
  • Do you mean you could not reproduce your issue with this line "var wordApp = new wordApplication.Application();" in a new simple WPF application?

    With only this error message, I am afraid we could not provide any further information.

    In addition, have you resolved thread below?

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/9503b2ac-f9cf-4451-938f-bea3c37a3b95/font-change-in-ppt-comment-for-empty-bullet-content?forum=oxmlsdk

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 5, 2018 6:10 AM
  • Any clue or workaround to fix this issue. it is Intermittent.

    Thanks

    Ankur


    Tuesday, March 6, 2018 12:22 PM
  • Hi Ankur,

    Due to the limitation of the community support channel, I afraid we are not able to troubleshoot this issue in an unreproducible environment. I will suggest you contacting the Microsoft professional support so that our engineers can work closely with you to troubleshoot this issue.

    If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are available to better meet your needs.

    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 7, 2018 1:59 AM