In my VB.NET application I have a class called Letter. In the constructor of the Letter class I initialize new word.application object.
Sub New()
_application = New Word.Application
End Sub
Recently I started to get a COM exception/error - Call was rejected by callee. After doing my research I have implemented the solution suggested in the following link:
Call was rejected by callee PowerPoint Automation
After the implementation I have the following code:
Sub New()
MessageFilterAPI.RegisterMessageFilter()
_application = New Word.Application
MessageFilterAPI.RevokeMessageFilter()
End Sub
This stopped error appearing on my machine (dev environment), but other machine where the software is installed still gets the error. Full exception message:
Creating an instance of the COM component with CLSID {000209FF-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80010001 Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
When debugging on the initializing line _application = New Word.Application
program completely crashes and freezes with the following exception:
The runtime has encountered a fatal error. The address of the error was at 0x74444ba1, on thread 0x5e48. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
Anyone has an idea why this is happening? This code hasn't been changed in years and it suddenly became an issue.