Daily Usage Issues

System.InvalidProgramException: Common Language Runtime detected an invalid program.

Started by htssoftwares on 5,089 views

Hello,

When using NCrunch on a .NET 5 project, that uses C# 9 records, NCrunch returns the following error for each tests :

System.InvalidProgramException: Common Language Runtime detected an invalid program.

The code that throws :

state with { Loading = true };
Where state is a record

This exception doesn't happens with standard test explorer.

Any way to avoir this ?

Thanks
Hi, thanks for sharing this issue.

We have a fix pending for this that we're hoping to push late this week. You can use the dev build below if you need the fix earlier:

NCrunch_Console_4.6.0.2.msi
NCrunch_Console_4.6.0.2.zip
NCrunch_GridNodeServer_4.6.0.2.msi
NCrunch_GridNodeServer_4.6.0.2.zip
NCrunch_LicenseServer_4.6.0.2.zip
NCrunch_VS2008_4.6.0.2.msi
NCrunch_VS2010_4.6.0.2.msi
NCrunch_VS2010_4.6.0.2.zip
NCrunch_VS2012_4.6.0.2.msi
NCrunch_VS2012_4.6.0.2.zip
NCrunch_VS2013_4.6.0.2.msi
NCrunch_VS2013_4.6.0.2.zip
NCrunch_VS2015_4.6.0.2.msi
NCrunch_VS2015_4.6.0.2.msi.7z
NCrunch_VS2015_4.6.0.2.zip
NCrunch_VS2017_4.6.0.2.msi
NCrunch_VS2017_4.6.0.2.msi.7z
NCrunch_VS2017_4.6.0.2.zip
NCrunch_VS2019_4.6.0.2.msi
NCrunch_VS2019_4.6.0.2.msi.7z
NCrunch_VS2019_4.6.0.2.zip
Hello Remco,

Thank you for your answer.
I downloaded and installed the build 4.6.0.2, however, I still have this issue.

For now, I'll disable NCrunch on this project and turn on Live Unit Testing, as it works with this.
But I'll be happy to re-enable NCrunch when this will be fixed !
htssoftwares wrote:
Thank you for your answer.
I downloaded and installed the build 4.6.0.2, however, I still have this issue.


Thanks for coming back to me on this. Your feedback here sets off alarm bells for me, as I was so sure that we had fixed this problem in the build above.

Can you check that you have v4.6.0.2 showing in the 'About' page for NCrunch? If so, is there any chance you can build a sample solution demonstrating the problem that you might be able to share with me? You can submit code in ZIP form through the NCrunch support contact form.
I have 4.6.0.2 on about page (BTW, copyright dates end in 2018).

I posted the sln that fails on my machine.
Thanks for the fast response! I think I know what's happening here.

Can you set the 'Instrumentation Mode' solution-level setting to 'Optimised' to see if this solves the issue?
It works perfectly ! Thank you :-)
This post has been deleted.
Helped us as well, thanks for the fix :)

Post a reply

Log in to reply.