System.AccessViolationException on client's machines

Add-in Express™ Support Service
That's what is more important than anything else

System.AccessViolationException on client's machines
 
letdowncrush


Guest


Hi,

We're getting the error below on clients machines when they install our Word plugin.

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at AddinExpress.MSO.ICTPFactory.CreateCTP(String CTPAxID, String CTPTitle, Object CTPParentWindow)
at AddinExpress.MSO.ADXAddinModule.AddCustomTaskPanes(Object parent, String outlookFolderName, Boolean showError)


I'm guessing that's internal AddInExpress code? When trying to create the custom take panes?

Is there indication of what could be causing this or any way to diagnose the issue?

They're getting it on Office Professional Plus 2016 but thus far we've been unable to replicate.
Posted 17 Aug, 2018 03:00:38 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello,

Most probably this is caused by July updates; see https://www.add-in-express.com/forum/read.php?FID=5&TID=15077 esp. the last post.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Aug, 2018 05:20:47 Top
letdowncrush


Guest


Thanks - is there a resolution?
Posted 17 Aug, 2018 06:05:38 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
One of the links suggests uninstalling .NET 4.7.2 if I'm not mistaken. Or, if UAC is turned off, turn it on.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Aug, 2018 06:41:01 Top
letdowncrush


Guest


Hi,

We've done some further investigation and think this might be a different issue to the July '18 update problems.

There are two exceptions fired when Word loads.

First:

Detailed technical information follows:
---
Assembly Codebase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
Assembly Full Name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly Version: 4.0.0.0

Exception Source:
Exception Type: System.ArgumentException
Exception Message: Invalid parent window specified.
Exception Target Site: ForwardCallToInvokeMember

---- Stack Trace ----
System.RuntimeType.ForwardCallToInvokeMember(memberName As String, flags As BindingFlags, target As Object, aWrapperTypes As Int32[], msgData As MessageData&)
mscorlib.dll: N 0193 (0xC1) IL
AddinExpress.MSO.ICTPFactory.CreateCTP(CTPAxID As String, CTPTitle As String, CTPParentWindow As Object)
mscorlib.dll: N 00000 (0x0) JIT
AddinExpress.MSO.ADXAddinModule.AddCustomTaskPanes(parent As Object, outlookFolderName As String, showError As Boolean)
mscorlib.dll: N 0653 (0x28D) IL


Second:

Detailed technical information follows:
---
Assembly Codebase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
Assembly Full Name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly Version: 4.0.0.0

Exception Source: mscorlib
Exception Type: System.AccessViolationException
Exception Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Exception Target Site: ForwardCallToInvokeMember

---- Stack Trace ----
System.RuntimeType.ForwardCallToInvokeMember(memberName As String, flags As BindingFlags, target As Object, aWrapperTypes As Int32[], msgData As MessageData&)
mscorlib.dll: N 0193 (0xC1) IL
AddinExpress.MSO.ICTPFactory.CreateCTP(CTPAxID As String, CTPTitle As String, CTPParentWindow As Object)
mscorlib.dll: N 00000 (0x0) JIT
AddinExpress.MSO.ADXAddinModule.AddCustomTaskPanes(parent As Object, outlookFolderName As String, showError As Boolean)
mscorlib.dll: N 0653 (0x28D) IL


These exceptions occur when the the start up screen is not set up display on start up and no blank document is shown.

The first exception seems to suggest there is an issue that is not being handled re: invalid parent window.
Posted 28 Aug, 2018 10:07:46 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Could you please provide more details about the scenario? I've understood about the Start screen. What do you mean by "no blank document is shown"?

What is the host application of your add-in? What is its build number? Is it Click-to-Run?


Andrei Smolin
Add-in Express Team Leader
Posted 28 Aug, 2018 10:39:07 Top
letdowncrush


Guest


The host application is Word - 16.0.4549.1000.

Just got access to a VM and it looks like the client has a macro that runs on start up that adds some functionality.

In reference to the point above, one of the things it is doing is closing down the blank document that you normally get when opening Word.

Could that be causing the issue? If so, would be good to be able to prevent those errors from being thrown at our end somehow.
Posted 28 Aug, 2018 11:14:44 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
It looks like Add-in Express doesn't expect that the macro closes the document; whence Invalid parent window specified. Could you please provide details of the macro implementation so that I could reproduce the issue on our side? You can send these details to the support email address; please make sure your email contains a link to this topic.

Is the macro located in Normal.dotm or in another template? Does the macro handles DocumentOpen, NewDocument, or it works in some other way?


Andrei Smolin
Add-in Express Team Leader
Posted 29 Aug, 2018 05:01:07 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Thank you very much. I've got an exception. This is Out of memory in my case. I assume the difference is caused by my using a different Word 2016 build. The issue is now filed under #13719 in our issue-tracking DB. Once I have news about it, I'll notify you.


Andrei Smolin
Add-in Express Team Leader
Posted 31 Aug, 2018 08:27:29 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello,

We've investigated the issue and found out that it isn't possible to fix it in the code of Add-in Express.

The point is: when the WindowActivate event occurs, the macro closes the document; after that Word raises the WindowActivate event on all COM add-ins. There's no way for us to find that the document was closed since the DocumentBeforeClose hasn't occurred yet.

A way to solve the issue is to suppress this exception in your add-in; see the OnError event of the add-in module.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Nov, 2018 05:07:39 Top