Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Problem with dotnet 5
stanac
#1 Posted : Wednesday, November 11, 2020 10:11:54 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/7/2019(UTC)
Posts: 6
Location: Serbia

Was thanked: 1 time(s) in 1 post(s)
Quote:
An error occurred while analysing this project after it was built: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\username\AppData\Local\NCrunch\15076\2\projectname.Tests\bin\Debug\net5.0\projectname.Tests.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\Users\username\AppData\Local\NCrunch\15076\2\projectname.Tests\bin\Debug\net5.0\projectname.Tests.dll'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at nCrunch.Common.ExecutionPlatform.LoadAssembly(FilePath assemblyFilePath)
at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker)


This happened after upgrading VS and projects to .net 5
michaelkroes
#2 Posted : Wednesday, November 11, 2020 10:13:40 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
We’re working to get a release out. I’ll post back when the release is out.
1 user thanked michaelkroes for this useful post.
upper on 11/11/2020(UTC)
stanac
#3 Posted : Wednesday, November 11, 2020 10:18:39 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/7/2019(UTC)
Posts: 6
Location: Serbia

Was thanked: 1 time(s) in 1 post(s)
Thanks for prompt response, great to hear it's being worked on
michaelkroes
#4 Posted : Wednesday, November 11, 2020 4:41:01 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
stanac
#5 Posted : Thursday, November 12, 2020 8:32:07 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/7/2019(UTC)
Posts: 6
Location: Serbia

Was thanked: 1 time(s) in 1 post(s)
RC is better than previous release, it can run tests, however it fails when C#9 "init" is used with "System.InvalidProgramException: Common Language Runtime detected an invalid program."

Problem is when a class is using init in property, nrunch reports error when calling constructor and setting that init property. Those same tests are passing in console "dotnet test" and VS test runner.
Remco
#6 Posted : Thursday, November 12, 2020 8:41:46 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Thanks for sharing this issue. We've just identified a problem where the usage of the new property initialisers is causing the complier to emit an IL sequence that we aren't handling right with our instrumentation.

We're working on a way to fix this now and hope to have it included soon in the next fix release. A workaround for the time being is to turn off the 'Analyse line execution times' setting for the project involved.
michaelkroes
#7 Posted : Thursday, November 12, 2020 2:47:42 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Would you mind trying the build below and checking if this works for you?

NCrunch_VS2019_4.6.0.1.msi
NCrunch_VS2019_4.6.0.1.msi.7z
NCrunch_VS2019_4.6.0.1.zip

This needs the new optimised instrumentation enabled. The legacy instrumentation doesn't support the new IL features.
1 user thanked michaelkroes for this useful post.
MihaMarkic on 11/20/2020(UTC)
ryanoneill1970
#8 Posted : Sunday, November 15, 2020 11:45:56 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/29/2015(UTC)
Posts: 7
Location: United Kingdom

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
This solves the init property problem for me.
1 user thanked ryanoneill1970 for this useful post.
Remco on 11/15/2020(UTC)
ovation22
#9 Posted : Friday, November 27, 2020 3:41:45 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/12/2018(UTC)
Posts: 6
Location: United States of America

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
I just tried 4.6.0.1 and I'm still experiencing the error with init properties:

Quote:

System.InvalidProgramException: Common Language Runtime detected an invalid program.
at SpeakerMeet.Core.DTOs.CommunityResult.set_Id(Guid value)
at SpeakerMeet.Core.Services.CommunityService.Map(Community community) in C:\Development\SpeakerMeet.Api\src\SpeakerMeet.Core\Services\CommunityService.cs:line 79
at SpeakerMeet.Core.Services.CommunityService.Get(Guid id) in C:\Development\SpeakerMeet.Api\src\SpeakerMeet.Core\Services\CommunityService.cs:line 34
at SpeakerMeet.Core.Tests.Services.CommunityServiceTests.Get.ItReturnsCommunity() in C:\Development\SpeakerMeet.Api\tests\SpeakerMeet.Core.Tests\Services\CommunityServiceTests\Get.cs:line 32
at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 264
--- End of stack trace from previous location ---
at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48
at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90



Feel free to clone the repo:

https://github.com/ovation22/SpeakerMeet.Api

Remco
#10 Posted : Friday, November 27, 2020 3:45:17 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Can you check if you have your 'Instrumentation Mode' set to 'Optimised'?
1 user thanked Remco for this useful post.
ovation22 on 11/28/2020(UTC)
ovation22
#11 Posted : Saturday, November 28, 2020 2:56:21 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/12/2018(UTC)
Posts: 6
Location: United States of America

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Yeah, that did it. Sorry, I didn't read closely enough to see how/where/that to set the instrumentation mode.

Thanks again!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.066 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download