Appbase being set to nothing at runtime - vb.net

I have a difficult to reproduce error on about three user installs out of 20. This is a .net Windows application, 2005 in VB.Net running on XP. After opening up a window, we get an error:
Could not load file or assembly 'Infragistics2.Win.UltraWinChart.v8.2,
Version=8.2.20082.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' or one of its
dependencies. Element not found. (Exception from HRESULT: 0x80070490) *****ClearTrac *****
at ClearTrac.ucNav.InitializeComponent()
at ClearTrac.ucNav..ctor()
at ClearTrac.frmPortfolio.InitializeComponent() ...
This happens also for the ReportViewer dll and a couple other infragistics dll's.
I turned on Bind Logging, and the first binds are ok, but when I get the error, the Appbase has been set to blank:
*** Assembly Binder Log Entry (2/20/2009 # 3:41:10 PM) ***
The operation failed.
Bind result: hr = 0x80070490. Element not found.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Documents and Settings\rdelaney\Local Settings\Apps\2.0\ZZ09GJK6.2VY\GPRTP6CM.GOX\clea..tion_8055aae51715540e_0001.0004_0a540274bbdc609c\ClearTrac.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = CAM\rdelaney
LOG: DisplayName = Microsoft.ReportViewer.WinForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase =
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ClearTrac.exe`
Calling assembly : ClearTrac, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Documents and Settings\rdelaney\Local Settings\Apps\2.0\ZZ09GJK6.2VY\GPRTP6CM.GOX\clea..tion_8055aae51715540e_0001.0004_0a540274bbdc609c\ClearTrac.exe.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070490).
Any ideas?

You should check that on problematic computers the Microsoft.ReportViewer.WinForms is either in GAC or in application directory.
If it's not, you should install Microsoft Report Viewer redistributable on problematiuc computers.
http://www.microsoft.com/downloads/details.aspx?FamilyID=cc96c246-61e5-4d9e-bb5f-416d75a1b9ef&displaylang=en

We found this error only happens under the .net Framework with SP1 or SP2 installed. With the bare .net framework 2.0 installed, it does not happen.

Related

Unit tests pass with "dotnet test" but fail when run from Visual Studio 2017 Test Explorer

My XUnit 2.2 tests all pass when run from the command line with dotnet test. When running them from Visual Studio 2017's Test Explorer some of the tests fail with Assembly Binding errors.
My test project targets .Net 4.6.2 and references an ASP.Net Core 1.1 application also targeting .Net 4.6.2. The unit tests were working fine in VS 2015 prior to upgrading to the .NET Core 1.1 release tooling and Visual Studio 2017.
The workaround was to create an app.config file for the test project and add all of the needed binding redirects to it via trial and error. I'm not sure why I have to do this, though.
It appears that when using dotnet test the runtime uses the newer assembly versions without complaint. When running from Visual Studio, the redirects are necessary.
Why is there a difference in the assembly binding behavior between these two methods of running the tests?
Sample assembly binding error:
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\PROFESSIONAL\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Extensions.Configuration.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
(Fully-specified)
LOG: Appbase = file:///C:/xx/xx/xx.Tests/bin/Debug/net462
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = C:\Users\xxxxx\AppData\Local\Temp\a1ec4d3c-04ff-4fa0-9e56-129e799dd870
LOG: AppName = a1ec4d3c-04ff-4fa0-9e56-129e799dd870
Calling assembly : Serilog.Settings.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\PROFESSIONAL\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Extensions.Configuration.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/xx/xx/xx.Tests/bin/Debug/net462/Microsoft.Extensions.Configuration.Abstractions.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\xx\xx\xx.Tests\bin\Debug\net462\Microsoft.Extensions.Configuration.Abstractions.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: Microsoft.Extensions.Configuration.Abstractions, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
And the redirect needed to solve it:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.1.1.0" />"
</dependentAssembly>
It turns out this issue is being tracked at https://github.com/Microsoft/vstest/issues/428
The workaround is to add the following two items to the test project's csproj file:
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
This eliminates the need for manually adding binding redirects.

System.IO.FileLoadException: Could not load file or assembly 'IBM.Data.DB2'

I am currently working on Outlook 2013 Addin Projects using visual studio 2013 and Visual Basic .Net. However, when I try to connect to DB2 Database. It shows that the dll files that I added into the project reference cannot be loaded.
What I do is add a new panes with a button in outlook which will look a windows form in outlook when the button is clicked. Onload the form, it will connect to DB2 and the below error message occur
System.IO.FileLoadException: Could not load file or assembly 'IBM.Data.DB2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7c307b91aa13d208' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
File name: 'IBM.Data.DB2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7c307b91aa13d208'
=== Pre-bind state information ===
LOG: DisplayName = IBM.Data.DB2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7c307b91aa13d208
(Fully-specified)
LOG: Appbase = file:///C:/Users/D0259/Documents/Visual Studio 2013/Projects/OutlookAddIn3/OutlookAddIn3/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : OutlookAddIn3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
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\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: IBM.Data.DB2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7c307b91aa13d208
LOG: Attempting download of new URL file:///C:/Users/D0259/Documents/Visual Studio 2013/Projects/OutlookAddIn3/OutlookAddIn3/bin/Debug/IBM.Data.DB2.DLL.
ERR: Failed to complete setup of assembly (hr = 0x80131045). Probing terminated.
Other windows form project using the same dll is working. Really need some advice on this. Anyone face this error before? Viewers' help is highly appreciated.

ASP.NET Register Assembly error

I am WAY out of my league here, so I apologize if I'm asking a duplicate question, but I don't know where to start on this one.
I recently migrated an SQL database from SERVER1, where it was collocated with IIS hosting the web interface to access the database, to SERVER2. The web interface is now accessing the database properly, and through some application features I can access the data properly, with no error. However, when I try to run a report, I get this error:
How do I fix this?
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 5: Namespace="AjaxControlToolkit"
Line 6: TagPrefix="ajaxToolkit" %>
Line 7: <%# Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Line 8: Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
Line 9:
Source File: /source/Report5.aspx Line: 7
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.4028
UPDATE
I turned on logging and got this more detailed error:
=== Pre-bind state information ===
LOG: User = AURORAFCS\raj
LOG: DisplayName = Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Family/
LOG: Initial PrivatePath = C:\Family\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Family\web.config
LOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
UPDATE2
Using fusion logger, I have this more detailed message, which shoes it a is a "File Cannot Be Found" error. However, I have installed the redistributables, so why can it not find the DLL?
*** Assembly Binder Log Entry (11/21/2014 # 4:00:35 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = AURORAFCS\raj
LOG: DisplayName = Microsoft.ReportViewer.WebForms, Version=8.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Partial)
LOG: Appbase = file:///C:/Family/
LOG: Initial PrivatePath = C:\Family\bin
LOG: Dynamic Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc46260e
LOG: Cache Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dc46260e
LOG: AppName = 807e5b0d
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Family\web.config
LOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/dc46260e/807e5b0d/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms.EXE.
LOG: Attempting download of new URL file:///C:/Family/bin/Microsoft.ReportViewer.WebForms/Microsoft.ReportViewer.WebForms.EXE.
LOG: All probing URLs attempted and failed.
You need to determine what version of the ReportViewer Control you are targeting and install the proper package on the same server that your web app is deployed.
Microsoft Report Viewer 2010 Redistributable Package
Microsoft Report Viewer 2008 SP1 Redistributable
Microsoft Report Viewer Redistributable 2008
Microsoft Report Viewer Redistributable 2005
I am sure the logic is as follows:
ReportViewer 2010 can be used against SQL Server 2008(SP2) and 2012
ReportViewer 2008 can be used against SQL Server 2008 and 2005
ReportViewer 2005 can be used against SQL Server 2005
I found the answer to my problem in this blog:
http://www.orcsweb.com/blog/desiree/access-report-viewer-dll-files-for-your-application/
I just extracted the needed DLL and put it into one of the directories that the webapp was looking for. Still not sure why it happened, though.

Could not load file or assembly 'interop.scripting, version=1.0.0.0,

I am running my project in debug mode and it work fine,
but when i tried to compile it shows this error: what does this error mean?
*** Assembly Binder Log Entry (3/27/2013 # 2:22:26 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Documents and Settings\nsbadmin\Desktop\antiSpam.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NIDECSUBIC\nsbadmin
LOG: DisplayName = antiSpam.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Documents and Settings/nsbadmin/Desktop/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : antiSpam, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Documents and Settings/nsbadmin/Desktop/en/antiSpam.resources.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/nsbadmin/Desktop/en/antiSpam.resources/antiSpam.resources.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/nsbadmin/Desktop/en/antiSpam.resources.EXE.
LOG: Attempting download of new URL file:///C:/Documents and Settings/nsbadmin/Desktop/en/antiSpam.resources/antiSpam.resources.EXE.
LOG: All probing URLs attempted and failed.
It seems that you are failed when trying to find a file resources. In VS, change it properties to be embeded into your exe file.

Problem running latest version of nhibernate

I downloaded latest version of NHibernate “2.1.0.2002”.
It built fine, but when I run my unit tests, I keep getting error :-
System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
It looks like somewhere it looks of old version.
Here is link
https://stackoverflow.com/questions/839112/problem-while-migrating-nhibernate-to-higher-version
This is internal error I am getting:
=== Pre-bind state information ===
LOG: DisplayName = NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
(Fully-specified)
LOG: Appbase = file:///D:/Project Files/CIS3G/Webapp/_Test_DAL/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : CIS3G.DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Project Files\CIS3G\Webapp\_Test_DAL\bin\Debug\_Test_DAL.dll.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///D:/Project Files/CIS3G/Webapp/_Test_DAL/bin/Debug/NHibernate.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Please check if you set the Specific Version-Property on your NHibernate Reference to 'true'? It doesn't seem to be the case on this error but with new NHibernate you need to provide an external ByteCodeProvider like Linfu.dll as well. Please check this also.
I've run into this before.
In my case the problem was that I was using a UnitOfWork implementation for handling Nhibernate sessionFactories.
I've been using this lib for a while so I just copied the compiled dll to a new test project with the new version of NHibernate, so I got the version problem.