Build/Test Issues

Could not load file or assembly after 4.2.0.7 update

Started by davetorutek on 15,313 views

Thanks for all the help so far! We've squashed some bugs but this last one is pretty persistent.

I've been looking at opensource projects that also use Microsoft.Extensions.Identity.Stores, I found one with several thousands tests. This project works fine in NCrunch. This doesn't give me much hope for manually reproducing the issue.

If you would be willing to help me once more there might be another way to diagnose this issue. I suspect the issue is in the json files we generate for the workspaces.

Could you please try:

  • Adding a net core console tool project to your solution
  • Reference the integration test project from the console tool
  • Build the console tool
  • Navigate to ConsoleTool\bin\Debug\netcoreapp3.1 and copy all the json files


  • On the NCrunch Tests window select a failing test (in the integration test project)
  • Right click, Advanced, Browse to selected workspace
  • Navigate to \bin\Debug\netcoreapp3.1 and copy all the json files


Could you send those via the support form or directly to me via michael at ncrunch.net?
michaelkroes wrote:Thanks for all the help so far! We've squashed some bugs but this last one is pretty persistent.

I've been looking at opensource projects that also use Microsoft.Extensions.Identity.Stores, I found one with several thousands tests. This project works fine in NCrunch. This doesn't give me much hope for manually reproducing the issue.

If you would be willing to help me once more there might be another way to diagnose this issue. I suspect the issue is in the json files we generate for the workspaces.

Could you please try:

  • Adding a net core console tool project to your solution
  • Reference the integration test project from the console tool
  • Build the console tool
  • Navigate to ConsoleTool\bin\Debug\netcoreapp3.1 and copy all the json files


  • On the NCrunch Tests window select a failing test (in the integration test project)
  • Right click, Advanced, Browse to selected workspace
  • Navigate to \bin\Debug\netcoreapp3.1 and copy all the json files


Could you send those via the support form or directly to me via michael at ncrunch.net?


Emailing it to you right now! Hopefully that helps.
Based on the information provided a new build was created. I'm posting the build here too if someone experiences the same error message they can try this version:

NCrunch_Console_4.3.0.4.msi
NCrunch_Console_4.3.0.4.zip
NCrunch_GridNodeServer_4.3.0.4.msi
NCrunch_GridNodeServer_4.3.0.4.zip
NCrunch_LicenseServer_4.3.0.4.zip
NCrunch_VS2008_4.3.0.4.msi
NCrunch_VS2010_4.3.0.4.msi
NCrunch_VS2010_4.3.0.4.zip
NCrunch_VS2012_4.3.0.4.msi
NCrunch_VS2012_4.3.0.4.zip
NCrunch_VS2013_4.3.0.4.msi
NCrunch_VS2013_4.3.0.4.zip
NCrunch_VS2015_4.3.0.4.msi
NCrunch_VS2015_4.3.0.4.msi.7z
NCrunch_VS2015_4.3.0.4.zip
NCrunch_VS2017_4.3.0.4.msi
NCrunch_VS2017_4.3.0.4.msi.7z
NCrunch_VS2017_4.3.0.4.zip
NCrunch_VS2019_4.3.0.4.msi
NCrunch_VS2019_4.3.0.4.msi.7z
NCrunch_VS2019_4.3.0.4.zip
Just want to inform that I experience a similar problem.
Was running NCrunch_VS2017_4.2.0.7

Tried downgrading to both NCrunch_VS2017_4.3.0.3 and NCrunch_VS2017_4.3.0.4 downloaded from this thread.
But the problem was still there.

Finally downgraded to NCrunch VS 2017_3.29.0.7.
The problem disappeared and my tests went green again.

Working in ASP.NET Core 2.1 and VS 2017.
Having VS 2019 installed on the machine but not NCrunch for VS 2019.

Edited

IngemarWard wrote:Just want to inform that I experience a similar problem.
Was running NCrunch_VS2017_4.2.0.7

Tried downgrading to both NCrunch_VS2017_4.3.0.3 and NCrunch_VS2017_4.3.0.4 downloaded from this thread.
But the problem was still there.

Finally downgraded to NCrunch VS 2017_3.29.0.7.
The problem disappeared and my tests went green again.

Working in ASP.NET Core 2.1 and VS 2017.
Having VS 2019 installed on the machine but not NCrunch for VS 2019.


Hi, thanks for posting. Sorry this isn't working for you.

Is there any chance you could convert this into a sample project for us?
michaelkroes wrote:
IngemarWard wrote:Just want to inform that I experience a similar problem.
Was running NCrunch_VS2017_4.2.0.7

Tried downgrading to both NCrunch_VS2017_4.3.0.3 and NCrunch_VS2017_4.3.0.4 downloaded from this thread.
But the problem was still there.

Finally downgraded to NCrunch VS 2017_3.29.0.7.
The problem disappeared and my tests went green again.

Working in ASP.NET Core 2.1 and VS 2017.
Having VS 2019 installed on the machine but not NCrunch for VS 2019.


Hi, thanks for posting. Sorry this isn't working for you.

Is there any chance you could convert this into a sample project for us?


Unfortunately my time schedule does not allow it. But I can give you a short description om my setup, if it helps:

WebApp project that that uses three other projects (dll:s)
One of these projects is hitting a Sql Server and getting data.
Seprate test project of that projects works fine.
But the tests of the webapp that uses the project that hits the database with the same procedures fails when the connection to the database is opened.
The error message and a part of the stack trace is:

an error occured GetVehicleScheduleVersion: System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.TdsParser' threw an exception. ---> System.IO.FileNotFoundException: [h]Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.[/h] Det går inte att hitta filen.
at Microsoft.Data.SqlClient.TdsParser..cctor()
--- End of inner exception stack trace ---
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\ProviderBase\DbConnectionPool.cs:line 1144
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\ProviderBase\DbConnectionPool.cs:line 1069
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\ProviderBase\DbConnectionFactory.cs:line 154
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Common\src\Microsoft\Data\ProviderBase\DbConnectionInternal.cs:line 328


And some extra info:
Just changed to version NCrunch_VS2017_4.1.0.1 (instead of NCrunch_VS2017_3.29.0.7 i previously downgraded to). Both are working fine and nog giving me the problem.

Edited

Thank you very much! I think I've got this reproduced under netcore 2.1. The issue is similar to netcore 2.2+ but will require a different solution. This might take some time to solve properly.

Thanks for you patience.

IngemarWard wrote:
michaelkroes wrote:
IngemarWard wrote:Just want to inform that I experience a similar problem.
Was running NCrunch_VS2017_4.2.0.7

Tried downgrading to both NCrunch_VS2017_4.3.0.3 and NCrunch_VS2017_4.3.0.4 downloaded from this thread.
But the problem was still there.

Finally downgraded to NCrunch VS 2017_3.29.0.7.
The problem disappeared and my tests went green again.

Working in ASP.NET Core 2.1 and VS 2017.
Having VS 2019 installed on the machine but not NCrunch for VS 2019.


Hi, thanks for posting. Sorry this isn't working for you.

Is there any chance you could convert this into a sample project for us?


Unfortunately my time schedule does not allow it. But I can give you a short description om my setup, if it helps:

WebApp project that that uses three other projects (dll:s)
One of these projects is hitting a Sql Server and getting data.
Seprate test project of that projects works fine.
But the tests of the webapp that uses the project that hits the database with the same procedures fails when the connection to the database is opened.
The error message and a part of the stack trace is:

an error occured GetVehicleScheduleVersion: System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.TdsParser' threw an exception. ---> System.IO.FileNotFoundException: [h]Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.[/h] Det går inte att hitta filen.
at Microsoft.Data.SqlClient.TdsParser..cctor()
--- End of inner exception stack trace ---
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\ProviderBase\DbConnectionPool.cs:line 1144
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\ProviderBase\DbConnectionPool.cs:line 1069
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\ProviderBase\DbConnectionFactory.cs:line 154
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Common\src\Microsoft\Data\ProviderBase\DbConnectionInternal.cs:line 328


And some extra info:
Just changed to version NCrunch_VS2017_4.1.0.1 (instead of NCrunch_VS2017_3.29.0.7 i previously downgraded to). Both are working fine and nog giving me the problem.

IngemarWard wrote:Sounds great!


I've created a build that passes my test that reproduces this issue. Would you mind trying this build to see if it works on your real solution?


NCrunch_Console_4.3.0.7.msi
NCrunch_Console_4.3.0.7.zip
NCrunch_GridNodeServer_4.3.0.7.msi
NCrunch_GridNodeServer_4.3.0.7.zip
NCrunch_LicenseServer_4.3.0.7.zip
NCrunch_VS2008_4.3.0.7.msi
NCrunch_VS2010_4.3.0.7.msi
NCrunch_VS2010_4.3.0.7.zip
NCrunch_VS2012_4.3.0.7.msi
NCrunch_VS2012_4.3.0.7.zip
NCrunch_VS2013_4.3.0.7.msi
NCrunch_VS2013_4.3.0.7.zip
NCrunch_VS2015_4.3.0.7.msi
NCrunch_VS2015_4.3.0.7.msi.7z
NCrunch_VS2015_4.3.0.7.zip
NCrunch_VS2017_4.3.0.7.msi
NCrunch_VS2017_4.3.0.7.msi.7z
NCrunch_VS2017_4.3.0.7.zip
NCrunch_VS2019_4.3.0.7.msi
NCrunch_VS2019_4.3.0.7.msi.7z
NCrunch_VS2019_4.3.0.7.zip
Using this latest build fixes the issue in our original project (I didn't test any of the other intermediate builds)
I tried vs2017_4.3-0-7.
Unfortunatly same problem as far as I can see.
But now another file cannot be found:
fail: VT.KorSpec.WebAPI.Controllers.TimeTableController[0]
an error occured GetVehicleScheduleVersion: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Det går inte att hitta filen.
File name: 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Text.SBCSCodePageEncoding.LoadManagedCodePage()
at System.Text.CodePagesEncodingProvider.GetEncoding(Int32 codepage)
at System.Text.EncodingProvider.GetEncodingFromProvider(Int32 codepage)
at System.Text.Encoding.GetEncoding(Int32 codepage)
at Microsoft.Data.SqlClient.TdsParser.TryProcessEnvChange(Int32 tokenLength, TdsParserStateObject stateObj, SqlEnvChange& sqlEnvChange) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 2519
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 2014
at Microsoft.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 1679
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs:line 1088
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs:line 1752
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs:line 1408
IngemarWard wrote:
Unfortunatly same problem as far as I can see.


I'm sorry to hear that. Is there any chance we can get a copy of the .deps file generated by MSBuild for the test project you're using? This file contains dependency information that we can hopefully use to reproduce the issue on our side. You can obtain this simply by building the test project and looking for the PROJECTNAME.deps.json file in the build output directory. You can submit this file through the NCrunch contact form.
Remco wrote:
IngemarWard wrote:
Unfortunatly same problem as far as I can see.


I'm sorry to hear that. Is there any chance we can get a copy of the .deps file generated by MSBuild for the test project you're using? This file contains dependency information that we can hopefully use to reproduce the issue on our side. You can obtain this simply by building the test project and looking for the PROJECTNAME.deps.json file in the build output directory. You can submit this file through the NCrunch contact form.


Sent a support request.
Subject. "File attachment. Request from NCrunch Developer Remco in forum thread."
Refrence in message to this thread

EDIT: I sent the wrong file. Will send the right one...
EDIT2: The new file sent
Subject: "File attachment #2. Request from NCrunch Developer Remco in forum thread."

Edited

Thanks for sending these through.

I've had a good go today at trying to reproduce this issue using the into in the .deps files you submitted.

Unfortunately, I haven't managed to get this to fail on my side. You have quite a complex structure in your solution with many different packages being referenced and many sub-dependencies. I think this problem might be dependent on not only the list of included packages, but perhaps also the sequence in which they are being loaded.

Sadly, it looks like I will actually needing a failing sample solution to progress further with this problem.

As a potential workaround, does adding a package reference from your test project directly to the System.Runtime.CompilerServices.Unsafe/4.5.1 resolve the issue?
Tried the workaround but that gave me som downgrading warning from

Made a solution copy that reproduces the error.
Zipped it and tried to post it like the previous one.
Subject: "File attachment #3. Request from NCrunch Developer Remco in forum thread"

But when submitting I got an error message:
"Sorry!
The page you tried to access does not exist. Click here to return to the home page of NCrunch.NET."
Tried two times

Did you get it?
Or did the submit form not allow it throuth?
IngemarWard wrote:
But when submitting I got an error message:
"Sorry!
The page you tried to access does not exist. Click here to return to the home page of NCrunch.NET."
Tried two times

Did you get it?
Or did the submit form not allow it throuth?


I wonder if it might be over the size limit. Could you try emailing it to support at ncrunch dot net?
IngemarWard wrote:Done!


Thanks! I've received the package and reproduced the problem more or less as described.

This looks complicated. It might be a few days. I'll let you know as soon as a fix is available.
Would you be interested in trying the build below to see if this solves the problem for you?

NCrunch_Console_4.3.0.9.msi
NCrunch_Console_4.3.0.9.zip
NCrunch_GridNodeServer_4.3.0.9.msi
NCrunch_GridNodeServer_4.3.0.9.zip
NCrunch_LicenseServer_4.3.0.9.zip
NCrunch_VS2008_4.3.0.9.msi
NCrunch_VS2010_4.3.0.9.msi
NCrunch_VS2010_4.3.0.9.zip
NCrunch_VS2012_4.3.0.9.msi
NCrunch_VS2012_4.3.0.9.zip
NCrunch_VS2013_4.3.0.9.msi
NCrunch_VS2013_4.3.0.9.zip
NCrunch_VS2015_4.3.0.9.msi
NCrunch_VS2015_4.3.0.9.msi.7z
NCrunch_VS2015_4.3.0.9.zip
NCrunch_VS2017_4.3.0.9.msi
NCrunch_VS2017_4.3.0.9.msi.7z
NCrunch_VS2017_4.3.0.9.zip
NCrunch_VS2019_4.3.0.9.msi
NCrunch_VS2019_4.3.0.9.msi.7z
NCrunch_VS2019_4.3.0.9.zip

Post a reply

Log in to reply.