Excel crashes with Automation addin

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

Excel crashes with Automation addin
 
Ashim Mishra


Guest


Hi Team,

I have been getting the excel crash issue while closing the excel.
We are using the Automation Addin for UDF, which sometimes get loaded in default app domain.
I have also tried to load the automation add in the same app domain as the COM one, using the Init UDF as:


var eVal = ExcelApp.Evaluate("=Init()");
string currentAppDomain = AppDomain.CurrentDomain.BaseDirectory;


But still sometimes it didn't get loaded in the same app domain. Because of that it leaves behind the orphan instance, so to fix this we also have created one UDF as KillUDF:


 if (_excelRCWCount != 0 && string.Equals(AppDomain.CurrentDomain.FriendlyName, _defaultDomain))
  {
    ExcelApp.Quit();
    GC.SuppressFinalize(ExcelApp);
    _excelRCWCount = Marshal.FinalReleaseComObject(ExcelApp);
    isKilled = true;
                    
    _log.Info("Killing orphan excel instance");
  }


which we are calling in AddinModule_AddinBeginShutdown.

I am adding the eventviewer logs for the crash issue, can you please check and suggest some other ways to this.

Report.wer:
Version=1
EventType=APPCRASH
EventTime=132445460896816185
ReportType=2
Consent=1
UploadTime=132445460911204853
ReportStatus=268435456
ReportIdentifier=52d6d95c-e9dd-440a-9502-c392337b4b34
IntegratorReportIdentifier=b40941f2-6a86-4792-af49-8f04afa681a6
Wow64Host=34404
OriginalFilename=Excel.exe
AppSessionGuid=00001500-0002-0020-b132-c79d6c8ad601
TargetAppId=W:0006055ef6446c3b93955080fe787259eb9b00000000!0000015d5f52bb54b4f0f379d73ad57bbac6354f801b!EXCEL.EXE
TargetAppVer=2020//08//11:08:19:31!1f8ddc0!EXCEL.EXE
BootId=4294967295
TargetAsId=3796
UserImpactVector=269484304
IsFatal=4294967295
EtwNonCollectReason=4
Response.BucketId=b1694208c7bfb3dc292257fc2864cecb
Response.BucketTable=4
Response.LegacyBucketId=1811106740677430987
Response.type=4
Sig[0].Name=Application Name
Sig[0].Value=EXCEL.EXE
Sig[1].Name=Application Version
Sig[1].Value=15.0.5275.1000
Sig[2].Name=Application Timestamp
Sig[2].Value=5f325493
Sig[3].Name=Fault Module Name
Sig[3].Value=mso.dll
Sig[4].Name=Fault Module Version
Sig[4].Value=15.0.5275.1000
Sig[5].Name=Fault Module Timestamp
Sig[5].Value=5f325bbd
Sig[6].Name=Exception Code
Sig[6].Value=c0000005
Sig[7].Name=Exception Offset
Sig[7].Value=000000000030f053
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=10.0.18362.2.0.0.256.48
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
UI[2]=C:\Program Files\Microsoft Office\Office15\EXCEL.EXE
UI[3]=Microsoft Excel has stopped working
UI[4]=Windows can check online for a solution to the problem and try to restart the program.
UI[5]=Check online for a solution and restart the program
UI[6]=Check online for a solution later and close the program
UI[7]=Close the program
LoadedModule[0]=C:\Program Files\Microsoft Office\Office15\EXCEL.EXE
LoadedModule[1]=C:\WINDOWS\SYSTEM32\ntdll.dll
LoadedModule[2]=C:\WINDOWS\System32\KERNEL32.DLL
LoadedModule[3]=C:\WINDOWS\System32\KERNELBASE.dll
LoadedModule[4]=C:\WINDOWS\SYSTEM32\apphelp.dll
LoadedModule[5]=C:\WINDOWS\System32\ADVAPI32.dll
LoadedModule[6]=C:\WINDOWS\System32\msvcrt.dll
LoadedModule[7]=C:\WINDOWS\System32\sechost.dll
LoadedModule[8]=C:\WINDOWS\System32\RPCRT4.dll
LoadedModule[9]=C:\WINDOWS\System32\ole32.dll
LoadedModule[10]=C:\WINDOWS\System32\combase.dll
LoadedModule[11]=C:\WINDOWS\System32\ucrtbase.dll
LoadedModule[12]=C:\WINDOWS\System32\bcryptPrimitives.dll
LoadedModule[13]=C:\WINDOWS\System32\GDI32.dll
LoadedModule[14]=C:\WINDOWS\System32\win32u.dll
LoadedModule[15]=C:\WINDOWS\System32\gdi32full.dll
LoadedModule[16]=C:\WINDOWS\System32\msvcp_win.dll
LoadedModule[17]=C:\WINDOWS\System32\USER32.dll
LoadedModule[18]=C:\Program Files\Microsoft Office\Office15\oart.dll
LoadedModule[19]=C:\WINDOWS\SYSTEM32\MSVCR100.dll
LoadedModule[20]=C:\WINDOWS\SYSTEM32\MSVCP100.dll
LoadedModule[21]=C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.18362.1082_none_cf6c86c73eed9f8f\gdiplus.dll
LoadedModule[22]=C:\WINDOWS\SYSTEM32\d2d1.dll
LoadedModule[23]=C:\WINDOWS\System32\IMM32.DLL
LoadedModule[24]=C:\Program Files\Common Files\Microsoft Shared\Office15\mso.dll
LoadedModule[25]=C:\WINDOWS\SYSTEM32\MSIMG32.dll
LoadedModule[26]=C:\WINDOWS\SYSTEM32\VERSION.dll
LoadedModule[27]=C:\WINDOWS\system32\uxtheme.dll
LoadedModule[28]=C:\WINDOWS\System32\MSCTF.dll
LoadedModule[29]=C:\WINDOWS\System32\OLEAUT32.dll
LoadedModule[30]=C:\WINDOWS\SYSTEM32\WTSAPI32.dll
LoadedModule[31]=C:\WINDOWS\SYSTEM32\WINSTA.dll
LoadedModule[32]=C:\WINDOWS\SYSTEM32\msi.dll
LoadedModule[33]=C:\WINDOWS\System32\SHELL32.dll
LoadedModule[34]=C:\WINDOWS\System32\cfgmgr32.dll
LoadedModule[35]=C:\WINDOWS\System32\shcore.dll
LoadedModule[36]=C:\WINDOWS\System32\windows.storage.dll
LoadedModule[37]=C:\WINDOWS\System32\profapi.dll
LoadedModule[38]=C:\WINDOWS\System32\powrprof.dll
LoadedModule[39]=C:\WINDOWS\System32\UMPDC.dll
LoadedModule[40]=C:\WINDOWS\System32\shlwapi.dll
LoadedModule[41]=C:\WINDOWS\System32\kernel.appcore.dll
LoadedModule[42]=C:\WINDOWS\System32\cryptsp.dll
LoadedModule[43]=C:\WINDOWS\System32\bcrypt.dll
LoadedModule[44]=C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.1082_none_9e8193e1e45b25c1\Comctl32.dll
LoadedModule[45]=C:\WINDOWS\SYSTEM32\srpapi.dll
LoadedModule[46]=C:\WINDOWS\System32\CRYPT32.dll
LoadedModule[47]=C:\WINDOWS\System32\MSASN1.dll
LoadedModule[48]=C:\WINDOWS\SYSTEM32\d3d10_1.dll
LoadedModule[49]=C:\WINDOWS\SYSTEM32\d3d10_1core.dll
LoadedModule[50]=C:\WINDOWS\SYSTEM32\d3d11.dll
LoadedModule[51]=C:\WINDOWS\SYSTEM32\dxgi.dll
LoadedModule[52]=C:\WINDOWS\SYSTEM32\dxcore.dll
LoadedModule[53]=C:\WINDOWS\SYSTEM32\D3D10Warp.dll
LoadedModule[54]=C:\WINDOWS\SYSTEM32\mscoree.dll
LoadedModule[55]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll
LoadedModule[56]=C:\WINDOWS\SYSTEM32\Secur32.dll
LoadedModule[57]=C:\WINDOWS\SYSTEM32\SSPICLI.DLL
LoadedModule[58]=C:\WINDOWS\System32\clbcatq.dll
LoadedModule[59]=C:\WINDOWS\System32\netprofm.dll
LoadedModule[60]=C:\WINDOWS\System32\WS2_32.dll
LoadedModule[61]=C:\WINDOWS\System32\npmproxy.dll
LoadedModule[62]=C:\WINDOWS\SYSTEM32\DNSAPI.dll
LoadedModule[63]=C:\WINDOWS\System32\NSI.dll
LoadedModule[64]=C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL
LoadedModule[65]=C:\WINDOWS\SYSTEM32\CRYPTBASE.DLL
LoadedModule[66]=C:\Program Files\Common Files\Microsoft Shared\Office15\riched20.dll
LoadedModule[67]=C:\WINDOWS\SYSTEM32\webservices.dll
LoadedModule[68]=C:\WINDOWS\System32\Normaliz.dll
LoadedModule[69]=C:\WINDOWS\SYSTEM32\WINHTTP.dll
LoadedModule[70]=C:\WINDOWS\SYSTEM32\dhcpcsvc6.DLL
LoadedModule[71]=C:\WINDOWS\SYSTEM32\dhcpcsvc.DLL
LoadedModule[72]=C:\WINDOWS\SYSTEM32\WININET.dll
LoadedModule[73]=C:\WINDOWS\SYSTEM32\iertutil.dll
LoadedModule[74]=C:\WINDOWS\SYSTEM32\ondemandconnroutehelper.dll
LoadedModule[75]=C:\WINDOWS\system32\mswsock.dll
LoadedModule[76]=C:\WINDOWS\SYSTEM32\urlmon.dll
LoadedModule[77]=C:\WINDOWS\SYSTEM32\WINNSI.DLL
LoadedModule[78]=C:\WINDOWS\SYSTEM32\sppc.dll
LoadedModule[79]=C:\WINDOWS\SYSTEM32\webio.dll
LoadedModule[80]=C:\WINDOWS\System32\fwpuclnt.dll
LoadedModule[81]=C:\WINDOWS\SYSTEM32\DWrite.dll
LoadedModule[82]=C:\Windows\System32\rasadhlp.dll
LoadedModule[83]=C:\WINDOWS\SYSTEM32\dwmapi.dll
LoadedModule[84]=C:\WINDOWS\system32\schannel.DLL
LoadedModule[85]=C:\WINDOWS\SYSTEM32\XmlLite.dll
LoadedModule[86]=C:\WINDOWS\SYSTEM32\Cabinet.dll
LoadedModule[87]=C:\WINDOWS\SYSTEM32\mskeyprotect.dll
LoadedModule[88]=C:\WINDOWS\SYSTEM32\ncrypt.dll
LoadedModule[89]=C:\WINDOWS\SYSTEM32\NTASN1.dll
LoadedModule[90]=C:\WINDOWS\system32\ncryptsslp.dll
LoadedModule[91]=C:\ProgramData\Microsoft\Windows Defender\platform\4.18.2008.9-0\MpOav.dll
LoadedModule[92]=C:\WINDOWS\SYSTEM32\USERENV.dll
LoadedModule[93]=C:\WINDOWS\SYSTEM32\gpapi.dll
LoadedModule[94]=C:\WINDOWS\SYSTEM32\DPAPI.DLL
LoadedModule[95]=C:\Program Files\Common Files\Microsoft Shared\OFFICE15\MSOIDCLIL.DLL
LoadedModule[96]=C:\WINDOWS\system32\propsys.dll
LoadedModule[97]=C:\WINDOWS\system32\rsaenh.dll
LoadedModule[98]=C:\Windows\System32\msxml6.dll
LoadedModule[99]=C:\WINDOWS\SYSTEM32\SensApi.dll
LoadedModule[100]=C:\Windows\System32\cryptnet.dll
LoadedModule[101]=C:\WINDOWS\SYSTEM32\MPR.DLL
LoadedModule[102]=C:\WINDOWS\System32\coml2.dll
LoadedModule[103]=C:\Users\sourabh.mishra\AppData\Local\Visible Alpha\Visible Alpha Excel Add-in\adxloader64.VAExcelPlugin.dll
LoadedModule[104]=C:\WINDOWS\System32\PSAPI.DLL
LoadedModule[105]=C:\WINDOWS\System32\WINTRUST.dll
LoadedModule[106]=C:\WINDOWS\SYSTEM32\OLEACC.dll
LoadedModule[107]=C:\WINDOWS\system32\directmanipulation.dll
LoadedModule[108]=C:\WINDOWS\SYSTEM32\WindowsCodecs.dll
LoadedModule[109]=C:\WINDOWS\SYSTEM32\dcomp.dll
LoadedModule[110]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
LoadedModule[111]=C:\WINDOWS\SYSTEM32\VCRUNTIME140_CLR0400.dll
LoadedModule[112]=C:\WINDOWS\SYSTEM32\ucrtbase_clr0400.dll
LoadedModule[113]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\mscorlib\8b0445ce5a447ad49f5d2104153ddbd4\mscorlib.ni.dll
LoadedModule[114]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System\84043d42d91958316db595f1576a37d5\System.ni.dll
LoadedModule[115]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll
LoadedModule[116]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Drawing\8810a3b178c15105a56fe219f3f654c9\System.Drawing.ni.dll
LoadedModule[117]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\f3519c9f846904873b51413ee8206687\System.Windows.Forms.ni.dll
LoadedModule[118]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Core\9fa4d9c28359a124319f7913c56490e7\System.Core.ni.dll
LoadedModule[119]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Configuration\f79f951be1712b7ee10f1db8393b8214\System.Configuration.ni.dll
LoadedModule[120]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Xml\8711ec25bf256423b1d3266da9f90012\System.Xml.ni.dll
LoadedModule[121]=C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.18362.1082_none_73b2803ad816b43c\comctl32.dll
LoadedModule[122]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll
LoadedModule[123]=C:\WINDOWS\SYSTEM32\WINSPOOL.DRV
LoadedModule[124]=C:\WINDOWS\System32\WLDAP32.dll
LoadedModule[125]=C:\WINDOWS\SYSTEM32\NETAPI32.dll
LoadedModule[126]=C:\WINDOWS\SYSTEM32\LOGONCLI.DLL
LoadedModule[127]=C:\WINDOWS\SYSTEM32\usp10.dll
LoadedModule[128]=C:\WINDOWS\SYSTEM32\netutils.dll
LoadedModule[129]=C:\WINDOWS\SYSTEM32\sxs.dll
LoadedModule[130]=C:\WINDOWS\SYSTEM32\DSPARSE.dll
LoadedModule[131]=C:\WINDOWS\system32\dataexchange.dll
LoadedModule[132]=C:\WINDOWS\system32\twinapi.appcore.dll
LoadedModule[133]=C:\WINDOWS\system32\RMCLIENT.dll
LoadedModule[134]=C:\WINDOWS\system32\kerberos.DLL
LoadedModule[135]=C:\WINDOWS\SYSTEM32\cryptdll.dll
LoadedModule[136]=C:\WINDOWS\system32\napinsp.dll
LoadedModule[137]=C:\WINDOWS\system32\pnrpnsp.dll
LoadedModule[138]=C:\WINDOWS\System32\winrnr.dll
LoadedModule[139]=C:\WINDOWS\system32\NLAapi.dll
LoadedModule[140]=C:\WINDOWS\system32\wshbth.dll
LoadedModule[141]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Management\2b9aee66f8313ffd91656b476a887f49\System.Management.ni.dll
LoadedModule[142]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\wminet_utils.dll
LoadedModule[143]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Net.Http\f9f3e1f8c9b3ecce74f80482672cfb49\System.Net.Http.ni.dll
LoadedModule[144]=C:\WINDOWS\system32\wbem\wmiutils.dll
LoadedModule[145]=C:\WINDOWS\SYSTEM32\wbemcomn.dll
LoadedModule[146]=C:\WINDOWS\SYSTEM32\amsi.dll
LoadedModule[147]=C:\WINDOWS\SYSTEM32\rasapi32.dll
LoadedModule[148]=C:\WINDOWS\SYSTEM32\rasman.dll
LoadedModule[149]=C:\WINDOWS\SYSTEM32\rtutils.dll
LoadedModule[150]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\WindowsBase\99df0be7210bc2415e4cf5e5f51d63cc\WindowsBase.ni.dll
LoadedModule[151]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\PresentationCore\af20e29509649d95428bf0c4494b0152\PresentationCore.ni.dll
LoadedModule[152]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Numerics\c8552275efa9cb39de1e86da5624f2d8\System.Numerics.ni.dll
LoadedModule[153]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\Presentatio5ae0f00f#\85b6392bbee4675f3f00eb4058189165\PresentationFramework.ni.dll
LoadedModule[154]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Xaml\693b935407aef5cec2b5f8cae122eb65\System.Xaml.ni.dll
LoadedModule[155]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Serv759bfb78#\e2bcbe080fc0288416e0c5b0d070c2cd\System.ServiceProcess.ni.dll
LoadedModule[156]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll
LoadedModule[157]=C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
LoadedModule[158]=C:\WINDOWS\WinSxS\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.9659_none_88dfc6bf2faefcc6\MSVCR80.dll
LoadedModule[159]=C:\WINDOWS\assembly\NativeImages_v2.0.50727_64\mscorlib\20aa1e736c3506e591c15e4bbca9252a\mscorlib.ni.dll
LoadedModule[160]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Data\241a8be63c3ccabd2cb99b416acb082a\System.Data.ni.dll
LoadedModule[161]=C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
LoadedModule[162]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Transactions\617cf3ac26f5a6a6bcea580203f74b6a\System.Transactions.ni.dll
LoadedModule[163]=C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll
LoadedModule[164]=C:\Users\sourabh.mishra\AppData\Local\Visible Alpha\Visible Alpha Excel Add-in\SQLite.Interop.dll
LoadedModule[165]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Runteb92aa12#\df9d4395c9f331e5add35f0e8c380312\System.Runtime.Serialization.ni.dll
LoadedModule[166]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Xml.Linq\069fd91da1f475a00c030cda947502a3\System.Xml.Linq.ni.dll
LoadedModule[167]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Ente96d83b35#\94b588d9ce4e545ff193b145c9a10654\System.EnterpriseServices.ni.dll
LoadedModule[168]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Ente96d83b35#\94b588d9ce4e545ff193b145c9a10654\System.EnterpriseServices.Wrapper.dll
LoadedModule[169]=C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll
LoadedModule[170]=C:\WINDOWS\System32\TextInputFramework.dll
LoadedModule[171]=C:\WINDOWS\System32\CoreUIComponents.dll
LoadedModule[172]=C:\WINDOWS\System32\CoreMessaging.dll
LoadedModule[173]=C:\WINDOWS\SYSTEM32\ntmarta.dll
LoadedModule[174]=C:\WINDOWS\SYSTEM32\wintypes.dll
LoadedModule[175]=C:\WINDOWS\system32\msimtf.dll
LoadedModule[176]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\CustomMarshalers\f9017b62ba9891f73c59f0e7ea3337fb\CustomMarshalers.ni.dll
LoadedModule[177]=C:\WINDOWS\Microsoft.Net\assembly\GAC_64\CustomMarshalers\v4.0_4.0.0.0__b03f5f7f11d50a3a\CustomMarshalers.dll
LoadedModule[178]=C:\WINDOWS\SYSTEM32\UIAutomationCore.DLL
LoadedModule[179]=C:\WINDOWS\SYSTEM32\wldp.dll
LoadedModule[180]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\wpfgfx_v0400.dll
LoadedModule[181]=C:\WINDOWS\SYSTEM32\MSVCP140_CLR0400.dll
LoadedModule[182]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\PresentationNative_v0400.dll
LoadedModule[183]=C:\WINDOWS\SYSTEM32\d3d9.dll
LoadedModule[184]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\Presentatioaec034ca#\6788d29e6723a6aeb30112b605a63901\PresentationFramework.Aero2.ni.dll
LoadedModule[185]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\Accessibility\17f39a0966f33022984396aa57e95869\Accessibility.ni.dll
LoadedModule[186]=C:\WINDOWS\SYSTEM32\WINMM.dll
LoadedModule[187]=C:\WINDOWS\SYSTEM32\WINMMBASE.dll
LoadedModule[188]=C:\Windows\System32\thumbcache.dll
LoadedModule[189]=C:\WINDOWS\SYSTEM32\policymanager.dll
LoadedModule[190]=C:\WINDOWS\SYSTEM32\msvcp110_win.dll
LoadedModule[191]=C:\Program Files\Microsoft Office\Office15\msproof7.dll
LoadedModule[192]=C:\Program Files\Microsoft Office\Office15\PROOF\msspell7.dll
LoadedModule[193]=C:\WINDOWS\System32\imagehlp.dll
LoadedModule[194]=c:\Program Files\Common Files\Microsoft Shared\VSTO\vstoee.dll
LoadedModule[195]=C:\PROGRA~1\COMMON~1\MICROS~1\SMARTT~1\MOFL.DLL
LoadedModule[196]=C:\WINDOWS\SYSTEM32\mfc100.dll
LoadedModule[197]=C:\WINDOWS\SYSTEM32\MFC100ENU.DLL
LoadedModule[198]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Web.Services\30d541362ab0e56d5ae97472136cccf0\System.Web.Services.ni.dll
LoadedModule[199]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Security\ff69619a5b96ac9801c1552e303a48af\System.Security.ni.dll
LoadedModule[200]=C:\WINDOWS\SYSTEM32\hlink.dll
LoadedModule[201]=C:\WINDOWS\SYSTEM32\edputil.dll
LoadedModule[202]=C:\WINDOWS\system32\spool\DRIVERS\x64\3\tsprint.dll
LoadedModule[203]=C:\WINDOWS\system32\spool\DRIVERS\x64\3\mxdwdrv.dll
LoadedModule[204]=C:\WINDOWS\SYSTEM32\opcservices.dll
LoadedModule[205]=C:\WINDOWS\SYSTEM32\xpsservices.dll
LoadedModule[206]=C:\WINDOWS\system32\windowscodecsext.dll
LoadedModule[207]=C:\WINDOWS\SYSTEM32\mscms.dll
LoadedModule[208]=C:\WINDOWS\SYSTEM32\ColorAdapterClient.dll
LoadedModule[209]=C:\WINDOWS\SYSTEM32\icm32.dll
LoadedModule[210]=C:\Users\sourabh.mishra\AppData\Local\Temp\dotnetbrowser-chromium\69.0.3497.12.1.21.1.0.676\64bit\d3dcompiler_47.dll
LoadedModule[211]=C:\WINDOWS\SYSTEM32\LINKINFO.dll
LoadedModule[212]=C:\WINDOWS\SYSTEM32\ntshrui.dll
LoadedModule[213]=C:\WINDOWS\SYSTEM32\srvcli.dll
LoadedModule[214]=C:\WINDOWS\SYSTEM32\cscapi.dll
LoadedModule[215]=C:\WINDOWS\system32\msctfui.dll
LoadedModule[216]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\UIAutomationTypes\3f9cb52e09e2696a9c17e4f74de8c8ac\UIAutomationTypes.ni.dll
LoadedModule[217]=C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\UIAutomationProvider\4e46151625899a79ef9560a9aee78506\UIAutomationProvider.ni.dll
LoadedModule[218]=C:\Program Files\Common Files\Microsoft Shared\OFFICE15\MSPTLS.DLL
LoadedModule[219]=C:\Program Files\Microsoft Office\Office15\OSF.DLL
LoadedModule[220]=C:\Program Files\Microsoft Office\Office15\OSFUI.DLL
LoadedModule[221]=C:\Program Files\Microsoft Office\Office15\OSFPROXY.DLL
LoadedModule[222]=C:\WINDOWS\SYSTEM32\ACTIVEDS.dll
LoadedModule[223]=C:\WINDOWS\SYSTEM32\adsldpc.dll
State[0].Key=Transport.DoneStage1
State[0].Value=1
OsInfo[0].Key=vermaj
OsInfo[0].Value=10
OsInfo[1].Key=vermin
OsInfo[1].Value=0
OsInfo[2].Key=verbld
OsInfo[2].Value=18362
OsInfo[3].Key=ubr
OsInfo[3].Value=1082
OsInfo[4].Key=versp
OsInfo[4].Value=0
OsInfo[5].Key=arch
OsInfo[5].Value=9
OsInfo[6].Key=lcid
OsInfo[6].Value=1033
OsInfo[7].Key=geoid
OsInfo[7].Value=244
OsInfo[8].Key=sku
OsInfo[8].Value=48
OsInfo[9].Key=domain
OsInfo[9].Value=1
OsInfo[10].Key=prodsuite
OsInfo[10].Value=256
OsInfo[11].Key=ntprodtype
OsInfo[11].Value=1
OsInfo[12].Key=platid
OsInfo[12].Value=10
OsInfo[13].Key=sr
OsInfo[13].Value=0
OsInfo[14].Key=tmsi
OsInfo[14].Value=228266
OsInfo[15].Key=osinsty
OsInfo[15].Value=3
OsInfo[16].Key=iever
OsInfo[16].Value=11.1082.18362.0-11.0.210
OsInfo[17].Key=portos
OsInfo[17].Value=0
OsInfo[18].Key=ram
OsInfo[18].Value=8192
OsInfo[19].Key=svolsz
OsInfo[19].Value=99
OsInfo[20].Key=wimbt
OsInfo[20].Value=0
OsInfo[21].Key=blddt
OsInfo[21].Value=190318
OsInfo[22].Key=bldtm
OsInfo[22].Value=1202
OsInfo[23].Key=bldbrch
OsInfo[23].Value=19h1_release
OsInfo[24].Key=bldchk
OsInfo[24].Value=0
OsInfo[25].Key=wpvermaj
OsInfo[25].Value=0
OsInfo[26].Key=wpvermin
OsInfo[26].Value=0
OsInfo[27].Key=wpbuildmaj
OsInfo[27].Value=0
OsInfo[28].Key=wpbuildmin
OsInfo[28].Value=0
OsInfo[29].Key=osver
OsInfo[29].Value=10.0.18362.1082.amd64fre.19h1_release.190318-1202
OsInfo[30].Key=buildflightid
OsInfo[30].Value={593CBA8B-93F8-4013-947F-46641E1F9334}.203
OsInfo[31].Key=edition
OsInfo[31].Value=Professional
OsInfo[32].Key=ring
OsInfo[32].Value=Retail
OsInfo[33].Key=expid
OsInfo[34].Key=containerid
OsInfo[35].Key=containertype
OsInfo[36].Key=edu
OsInfo[36].Value=0
FriendlyEventName=Stopped working
ConsentKey=APPCRASH
AppName=Microsoft Excel
AppPath=C:\Program Files\Microsoft Office\Office15\EXCEL.EXE
ApplicationIdentity=00000000000000000000000000000000
MetadataHash=957062196

------------------------------------------------------------------------------------------
Faulting application name: EXCEL.EXE, version: 15.0.5275.1000, time stamp: 0x5f325493
Faulting module name: mso.dll, version: 15.0.5275.1000, time stamp: 0x5f325bbd
Exception code: 0xc0000005
Fault offset: 0x000000000030f053
Faulting process id: 0x1500
Faulting application start time: 0x01d68a6c9dc732b1
Faulting application path: C:\Program Files\Microsoft Office\Office15\EXCEL.EXE
Faulting module path: C:\Program Files\Common Files\Microsoft Shared\Office15\mso.dll
Report Id: b40941f2-6a86-4792-af49-8f04afa681a6
Faulting package full name:
Faulting package-relative application ID:


Fault bucket 1811106740677430987, type 4
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: EXCEL.EXE
P2: 15.0.5275.1000
P3: 5f325493
P4: mso.dll
P5: 15.0.5275.1000
P6: 5f325bbd
P7: c0000005
P8: 000000000030f053
P9:
P10:
Posted 14 Sep, 2020 07:30:53 Top
Andrei Smolin


Add-in Express team


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

This is Excel who controls the add-in, not the other way. The idea of closing Excel in that event is wrong and you should look for a different solution. I suggest that you look into creating an XLL add-in, not the Excel Automation add-in.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Sep, 2020 07:40:02 Top
Ashim Mishra


Guest


Hi Andrei,


We also need to call Excel Interop objects to get the range object in some formulas, for those type of formulas we still need the Automation Addin.

I suggest that you look into creating an XLL add-in, not the Excel Automation add-in.


What do you mean by that so anyone who have the automation addin is bound to have excel hanging issue( if we don't use KillUDF that's what happens), isn't something AddinExpress provide to fix this ?
Posted 14 Sep, 2020 10:00:28 Top
Andrei Smolin


Add-in Express team


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

Ashim Mishra writes:
We also need to call Excel Interop objects to get the range object in some formulas


What do you do next with that range? Does it influence the actual value the formula returns to the caller cell? At https://www.add-in-express.com/creating-addins-blog/2011/10/11/invoke-excel-addin-xll/, we describe this approach: there's a combination of XLL add-in and COM add-in; when an XLL function is invoked, it signals the COM add-in which performs the object model call *after a delay* (the delay is essential).

Ashim Mishra writes:
so anyone who have the automation addin is bound to have excel hanging issue


I assume the hang is a result of something in your code, in that Excel build, or both; I can't remember a sample add-in of ours ever showed this behavior.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Sep, 2020 10:29:18 Top
Ashim Mishra


Guest


Hi Andrei,

we use the range object to get the calling Range:
like

var callingRange = Module.CallWorksheetFunction(ADXExcelWorksheetFunction.Caller) as ADXExcelRef;
var index = callingRange.ConvertToA1Style();
param.CallingRange = Module.ExcelApp.Range[index];


This call param.CallingRange = Module.ExcelApp.Range[index] sometime creates issue and throws COMException that's why we have to still reply on the Automation Addin. The sample code that you have attached as part of https://www.add-in-express.com/creating-addins-blog/2011/10/11/invoke-excel-addin-xll/ doesn't have any example for this use case.

Our use case is in such a way that we have a formula which tries to find the stats from another formula, for e.g

cell A1 = GetData(p1, p2, p3, p4)

cell A3 = GetStats(A1, "Average") : For this function we need to find the CallingRange to parse the formula and do other manipulation like of A1, is a formula or a cell Reference etc.


As far as the Excel Hang issue is concerned we get this issue only when Automation Addin doesn't load in the same appdomain as the COM Addin.
Posted 14 Sep, 2020 10:41:57 Top
Andrei Smolin


Add-in Express team


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

At https://www.add-in-express.com/docs/net-excel-udf-tips.php#determining-cell, we write:

In your XLL add-in, you use the ADXXLLModule.CallWorksheetFunction method [to get the caller cell]. The ADXExcelRef returned by that method allows determining the index (indices) of the cell(s) on the worksheet the UDF is called from. You can also call the ADXExcelRef.ConvertToA1Style (or ConvertToR1C1Style) method and get a string representing the caller's address, which is convertible to an Excel.Range by passing it to the _Module.ExcelApp.Range method (in C#, the second parameter of the Range method is Type.Missing). The _Module (Module in C#) above is an automatically generated property of the XLLContainer class. The ExcelApp above is an automatically generated property of the ADXXLLModule class.


The blog I pointed you to demonstrates invoking the Excel object model after a small delay: the Xll module determines the data needed (say, the address of the cell), puts the address to a list, and invokes SendMessage passing it the index of the list item in one of the two paramaters available. When the OnSendMessage event occurs, you retrieve the the index, get the item and perform your action.

I don't think it is possible to load an Automation add-in in a separate AppDomain in *all* scenarios.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2020 03:08:16 Top
Ashim Mishra


Guest


Hi Andrei,

As always thanks for your prompt reply.

As you said
When the OnSendMessage event occurs, you retrieve the the index, get the item and perform your action.


If i want to update the value on the index and also want to keep the UDF formula that user have entered, how i can do that.

Generally Triggering a UDF ensure that it returns something, by also maintaining the formula that someone has entered.

To give you an example, let's say on cell E2 i entered "=GetStats()" , i got the index of the cell and from UDF I returned #Loading and also triggered Send_Message. In the send message i picked the item from the list and calculated the value. Once i know the value i can set the value as

cell.Value2 = "some value"

but if i set the value in such a way it will lost the UDF formula that i have entered. Can you suggest some other way to do that ?
Posted 15 Sep, 2020 08:49:06 Top
Andrei Smolin


Add-in Express team


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

Ashim Mishra writes:
cell A1 = GetData(p1, p2, p3, p4)
cell A3 = GetStats(A1, "Average")


Mmm, it looks like you need to retrieve the address of the A1 in the GetStats() XLL function. If so, you can set ADXExcelParameterDescriptor.AcceptAsArray = false on the corresponding parameter descriptor. In this case, the function receives an ADXExcelRef (if AcceptAsArray is true, the function receives a value or an array of values); you call ADXExcelRef.ToA1String() to get the address of that range.

Can you perform your work here without using the Excel object model?


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2020 09:39:47 Top
Ashim Mishra


Guest


Hi Andrei,

I got your point, but it's not that simple. In GetData we can also use cell reference to get the value, now at the time of calculating the value for GetStats we have to know if the parameter for the formula defined on cell A1, are having nested cell reference or not.

For e.g

GetData("cName", $A$1, $C$3)

In GetStats we have to analyse the complete formula structure, which requires dealing with ExcelApp.Workbook Worksheet and Range object.

That's why i am afraid we still have to use the Excel object model.

I like the way you suggested to use the Send_message but the only issue here is to keep the formula in the cell when we update the value.

Any thoughts on this ?
Posted 15 Sep, 2020 11:33:59 Top
Andrei Smolin


Add-in Express team


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


public static object GetStats(object arg)
{
    if (arg is AddinExpress.MSO.ADXExcelRef)
    {
        object formula = Module.CallWorksheetFunction(ADXExcelWorksheetFunction.GetFormula, new object[] { arg as AddinExpress.MSO.ADXExcelRef });
        return formula.ToString();
    }
    return "Not a cell reference";
}

public static object GetData(object arg1, object arg2, object arg3)
{
    return DateTime.Now.ToLongTimeString();
}


User added an image

The formula in A3 is "=GetStats(A1)".


Andrei Smolin
Add-in Express Team Leader
Posted 16 Sep, 2020 02:05:31 Top