07-22-2019 03:53 PM - edited 07-22-2019 03:54 PM
Hello,
I recently switched to NI 2019 and didn't realize that once my apps are deployed on a "production" system, they crash with "System.IO.FileLoadException". I searched this forum and looks like it could be a mismatch with .NET version or something related.
I attached all files I could gather for troubleshooting. Please let me know what I am missing. Thank you!
Edit: this is what's inside .wer file
Version=1 EventType=CLR20r3 EventTime=132083006954137528 ReportType=2 Consent=1 ReportIdentifier=c3fbdc38-acbe-11e9-9bf5-54ee7530faae IntegratorReportIdentifier=c3fbdc37-acbe-11e9-9bf5-54ee7530faae Response.type=4 Sig[0].Name=Problem Signature 01 Sig[0].Value=ExpressCompTool.exe Sig[1].Name=Problem Signature 02 Sig[1].Value=1.0.0.20 Sig[2].Name=Problem Signature 03 Sig[2].Value=ab5836b7 Sig[3].Name=Problem Signature 04 Sig[3].Value=ExpressCompTool Sig[4].Name=Problem Signature 05 Sig[4].Value=1.0.0.20 Sig[5].Name=Problem Signature 06 Sig[5].Value=ab5836b7 Sig[6].Name=Problem Signature 07 Sig[6].Value=1 Sig[7].Name=Problem Signature 08 Sig[7].Value=3f Sig[8].Name=Problem Signature 09 Sig[8].Value=System.IO.FileLoadException DynamicSig[1].Name=OS Version DynamicSig[1].Value=6.1.7601.2.1.0.256.48 DynamicSig[2].Name=Locale ID DynamicSig[2].Value=1033 DynamicSig[22].Name=Additional Information 1 DynamicSig[22].Value=52a4 DynamicSig[23].Name=Additional Information 2 DynamicSig[23].Value=52a47bae162b5056874cd9b250824114 DynamicSig[24].Name=Additional Information 3 DynamicSig[24].Value=19d8 DynamicSig[25].Name=Additional Information 4 DynamicSig[25].Value=19d899072b5974d4d62c96d0f9ec7235 UI[2]=C:\Diagnostics\ExpressCompTool.exe UI[3]=HF Comprehensive Tool has stopped working UI[4]=Windows can check online for a solution to the problem. UI[5]=Check online for a solution and close the program UI[6]=Check online for a solution later and close the program UI[7]=Close the program LoadedModule[0]=C:\Diagnostics\ExpressCompTool.exe LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll LoadedModule[2]=C:\Windows\SYSTEM32\MSCOREE.DLL LoadedModule[3]=C:\Windows\system32\KERNEL32.dll LoadedModule[4]=C:\Windows\system32\KERNELBASE.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\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll LoadedModule[10]=C:\Windows\system32\SHLWAPI.dll LoadedModule[11]=C:\Windows\system32\GDI32.dll LoadedModule[12]=C:\Windows\system32\USER32.dll LoadedModule[13]=C:\Windows\system32\LPK.dll LoadedModule[14]=C:\Windows\system32\USP10.dll LoadedModule[15]=C:\Windows\system32\IMM32.DLL LoadedModule[16]=C:\Windows\system32\MSCTF.dll LoadedModule[17]=C:\Windows\system32\nvinitx.dll LoadedModule[18]=C:\PROGRA~2\Sophos\SOPHOS~1\SOPHOS~2.DLL LoadedModule[19]=C:\Windows\system32\PSAPI.DLL LoadedModule[20]=C:\Windows\system32\VERSION.dll LoadedModule[21]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll LoadedModule[22]=C:\Windows\system32\MSVCR120_CLR0400.dll LoadedModule[23]=C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\b308b9c61f65cf2dfd876031ee385ba4\mscorlib.ni.dll LoadedModule[24]=C:\Windows\system32\ole32.dll LoadedModule[25]=C:\Windows\system32\CRYPTBASE.dll LoadedModule[26]=C:\Windows\system32\uxtheme.dll LoadedModule[27]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System\095a3392942c3d4eb888e6a32036acd8\System.ni.dll LoadedModule[28]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Core\75913bbaf1bee617a94dcd6b5df12a5d\System.Core.ni.dll LoadedModule[29]=C:\Windows\assembly\NativeImages_v4.0.30319_64\WindowsBase\6110ecf056356557d5798a1583a1c434\WindowsBase.ni.dll LoadedModule[30]=C:\Windows\system32\CRYPTSP.dll LoadedModule[31]=C:\Windows\system32\rsaenh.dll LoadedModule[32]=C:\Windows\assembly\NativeImages_v4.0.30319_64\PresentationCore\ceff7eae18ed09ff1116ebf9af497790\PresentationCore.ni.dll LoadedModule[33]=C:\Windows\assembly\NativeImages_v4.0.30319_64\Presentatio5ae0f00f#\3d01d2b7bde19d91d70c4ff96eea3432\PresentationFramework.ni.dll LoadedModule[34]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Xaml\76a6a6b0f7fb1fbd64a800b5fc3d47bb\System.Xaml.ni.dll LoadedModule[35]=C:\Windows\system32\dwrite.dll LoadedModule[36]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\wpfgfx_v0400.dll LoadedModule[37]=C:\Windows\system32\MSVCP120_CLR0400.dll LoadedModule[38]=C:\Windows\system32\OLEAUT32.dll LoadedModule[39]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\PresentationNative_v0400.dll LoadedModule[40]=C:\Windows\system32\api-ms-win-core-xstate-l2-1-0.dll LoadedModule[41]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll LoadedModule[42]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\nlssorting.dll LoadedModule[43]=C:\Windows\system32\WRusr.dll LoadedModule[44]=C:\Windows\system32\SHELL32.dll LoadedModule[45]=C:\Windows\system32\MSIMG32.dll LoadedModule[46]=C:\Windows\system32\profapi.dll LoadedModule[47]=C:\Windows\system32\WindowsCodecs.dll LoadedModule[48]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Configuration\36778d2072c745f0ad72f7e219122258\System.Configuration.ni.dll LoadedModule[49]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Xml\8821b72d5d51079acf96e90c4af19a96\System.Xml.ni.dll LoadedModule[50]=C:\Windows\system32\bcrypt.dll LoadedModule[51]=C:\Windows\system32\RpcRtRemote.dll LoadedModule[52]=C:\Windows\assembly\NativeImages_v4.0.30319_64\Presentatio1c9175f8#\7600f870ebcc661f412ab16465a64647\PresentationFramework.Aero.ni.dll LoadedModule[53]=C:\Windows\system32\dwmapi.dll LoadedModule[54]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll FriendlyEventName=Stopped working ConsentKey=CLR20r3 AppName=HF Comprehensive Tool AppPath=C:\Diagnostics\ExpressCompTool.exe
Solved! Go to Solution.
07-23-2019 10:37 AM
Looking at the NI .NET Deployment help topic, you may be missing the specific versions of the SharpDX assemblies that are referenced by the NationalInstruments.Controls.Graphs assembly.
Assuming it is an assembly load failure, you could also try using the .NET Assembly Binding Log Viewer to get more information about the specific failure.
07-23-2019 03:03 PM
Thank you, Paul.
Learned today how useful fuslogvw is (only used to depends.exe)
Anyway, I traced it down to this issue but I have no clue what it could be... didn't even know Version=17.5.40.49153 exists (didn't we go from 15 to 19?)
*** Assembly Binder Log Entry (07/23/2019 @ 03:15:33 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Diagnostics\ExpressCompTool.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
(Fully-specified)
LOG: Appbase = file:///C:/Diagnostics/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ExpressCompTool.exe
Calling assembly : NationalInstruments.Controls, Version=19.0.45.54571, Culture=neutral, PublicKeyToken=4febd62461bf11a4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Diagnostics/NationalInstruments.Common.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Diagnostics\NationalInstruments.Common.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: NationalInstruments.Common, Version=19.0.40.49152, Culture=neutral, PublicKeyToken=dc6ad606294fc298
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
*** Assembly Binder Log Entry (07/23/2019 @ 03:15:33 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Diagnostics\ExpressCompTool.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
(Fully-specified)
LOG: Appbase = file:///C:/Diagnostics/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ExpressCompTool.exe
Calling assembly : NationalInstruments.Controls, Version=19.0.45.54571, Culture=neutral, PublicKeyToken=4febd62461bf11a4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Diagnostics/NationalInstruments.Common.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Diagnostics\NationalInstruments.Common.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: NationalInstruments.Common, Version=19.0.40.49152, Culture=neutral, PublicKeyToken=dc6ad606294fc298
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
*** Assembly Binder Log Entry (07/23/2019 @ 03:16:35 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Diagnostics\ExpressCompTool.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
(Fully-specified)
LOG: Appbase = file:///C:/Diagnostics/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ExpressCompTool.exe
Calling assembly : NationalInstruments.Controls, Version=19.0.45.54571, Culture=neutral, PublicKeyToken=4febd62461bf11a4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Diagnostics/NationalInstruments.Common.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Diagnostics\NationalInstruments.Common.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: NationalInstruments.Common, Version=19.0.40.49152, Culture=neutral, PublicKeyToken=dc6ad606294fc298
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
*** Assembly Binder Log Entry (07/23/2019 @ 03:16:35 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Diagnostics\ExpressCompTool.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
(Fully-specified)
LOG: Appbase = file:///C:/Diagnostics/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ExpressCompTool.exe
Calling assembly : NationalInstruments.Controls, Version=19.0.45.54571, Culture=neutral, PublicKeyToken=4febd62461bf11a4.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: NationalInstruments.Common, Version=17.5.40.49153, Culture=neutral, PublicKeyToken=dc6ad606294fc298
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Diagnostics/NationalInstruments.Common.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Diagnostics\NationalInstruments.Common.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: NationalInstruments.Common, Version=19.0.40.49152, Culture=neutral, PublicKeyToken=dc6ad606294fc298
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
07-23-2019 03:19 PM
Ah, so it is a versioning issue with the Common assembly. This is covered in the Publisher Policy Files section of the deployment help topic. I believe you will want to include an app.config
file for your application that looks something like this:
<?xml version="1.0" encoding="utf-8"?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="NationalInstruments.Common" publicKeyToken="dc6ad606294fc298" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-19.0.45.54571" newVersion="19.0.45.54571" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
@kirko7 wrote:
... didn't even know Version=17.5.40.49153 exists (didn't we go from 15 to 19?)
The Common assembly is shipped with .NET drivers as well as Measurement Studio libraries, so it is updated more frequently.
07-23-2019 04:23 PM
The DLL file version that I reference and install at the target machine is 19.0.40.49152 so I had to do this instead, does it make sense?
<bindingRedirect oldVersion="0.0.0.0-19.0.45.54571" newVersion="19.0.40.49152"/>
However, even with this change I still get error at the same place. But this time it's only 2 instances of "Assembly Binder Entries" instead of 4. So it definitely helped but only partly. I do reference NationalInstruments.Common in other other supporting DLLs but there's no app.config for DLLs. Does it mean I have to go through the process of creating global assembly cache?
Also, could you please clarify this quote "If you do not deploy an application configuration file and you deploy assemblies that were built with older versions of deployed assemblies (such as NationalInstruments.Common.dll), the deployed application may crash at assembly load time"
Thank you!
07-23-2019 04:41 PM
@kirko7 wrote:The DLL file version that I reference and install at the target machine is 19.0.40.49152 so I had to do this instead, does it make sense?
That seems fine to me (I just pulled the first version number from the error log you provided to create my example config file).
I do reference NationalInstruments.Common in other other supporting DLLs but there's no app.config for DLLs. Does it mean I have to go through the process of creating global assembly cache?
If all of those DLLs are loaded by the same application, then the app.config
for that application should get used. Though if the DLLs are using conflicting versions of Common (or if the target machine does have some old version of Common already in the GAC), then updating the GAC may be required.
1. Does it mean that app.config has to actually be deployed on the target machine (as in part of the installer)?
The app.config
file just needs to be located next to the application (e.g. when you build your project, the app.config
file should be automatically copied to the build folder as YourApplication.exe.config
). Where you copy that file to the machine, or an installer puts it there, should not matter.
2. Is there something I can do to avoid all of these redirects?
The Installer Builder tool was created to support these kinds of deployment scenarios. It can generate an installer that will perform any required GAC assembly registration automatically.
07-23-2019 05:00 PM
Phew! I got this to work! I did include the .config file but also turned out that I needed to update one of the Sharp*.dll files.
Thank you for guiding me through this! I hope this will be useful for someone else.