Excel-DNA / ExcelDna

Excel-DNA - Free and easy .NET for Excel. This repository contains the core Excel-DNA library.
https://excel-dna.net
zlib License
1.3k stars 276 forks source link

Excel crash with AccessViolation on shutdown with IntelliSense and no Workbook #716

Open govert opened 2 months ago

govert commented 2 months ago

From https://groups.google.com/g/exceldna/c/QoIb9BkqvJI

While I was going quite successful, last night I came across a strange situation for the first time to find out that if I debug the Excel Dna AddIn, enable the same at the launch of Excel Application, but close the Excel right away without carrying on or opening a book, I face the error:

System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source= StackTrace:

Interestingly it is only if I have in my project file the following package installed: With simple AddIn file: Public Class ExcelDnaAddIn Implements IExcelAddIn Public Sub AutoOpen() Implements IExcelAddIn.AutoOpen IntelliSenseServer.Install() End Sub Public Sub AutoClose() Implements IExcelAddIn.AutoClose IntelliSenseServer.Uninstall() End Sub End Class Any reason and way to resolve the said problem?
jacobneroth commented 3 weeks ago

Hi govert, I have similar problems as well. AppName EXCEL.EXE AppVersion 16.0.17328.20588 AppTimeStamp 66de8549 ModuleName KERNELBASE.dll ModuleVersion 10.0.22621.3296 ModuleTimeStamp 71c4f65c ExceptionCode e0434352 FaultingOffset 00149542 ProcessId 0x1674 ProcessCreationTime 0x1db1b298ee37e3a AppPath C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE ModulePath C:\WINDOWS\System32\KERNELBASE.dll IntegratorReportId cd8dba3d-a514-4b9a-af37-f85553a25e50 PackageFullName
PackageRelativeAppId

What fixed it was removing the intellsense install and uninstall. What is weird is, it only happens for certain PC's at work.

govert commented 3 weeks ago

Can you confirm this with the latest Excel-DNA packages version 1.9.0-alpha2 ? We did try to mitigate some related problems recently - maybe this is already addressed.

Are you seeing this without a debugger attached? I have been seeing crashes when the debugger is attached, but not exactly as you describe.

jacobneroth commented 2 weeks ago

let me try with the 1.9.0-alpha2, sorry was away for a while. just got back. We are seeing it without the debugger attached. we are seeing it when people open the excel sheet. was able to mitigate the problem by creating a feature flag to not run the Intellisense Install or Uninstall. WHat is weird is, it only has a problem in certain pcs even though the Office Build and the Windows build is the same. a sample size of 3 has this problem, while 18 others didnt have any issues