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

Notification

Icon
Error

InvalidOperationException with init properties (.net6)
ericwinkler
#1 Posted : Tuesday, January 4, 2022 2:59:08 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/4/2022(UTC)
Posts: 1
Location: Australia

After some minor refactoring, a codebase began experiencing unexpected test failures via the ncrunch runner, that were not also failures when using other runners.

System.InvalidProgramException: Common Language Runtime detected an invalid program.
(With a call stack ending at an attempt to set an init property.)

After some investigation it appears to be related to use of System.Runtime.CompilerServices IsExternalInit which I introduced a while ago as part of a preview feature workaround. Ultimately I no longer required the workaround and was able to remove my defintiion of IsExternalInit to restore successful test execution via ncrunch.

Minimal repro here: https://github.com/eric-winkler/ncruncherror
This may be the same issue as https://forum.ncrunch.ne...rties-again---NET-5.aspx
Remco
#2 Posted : Tuesday, January 4, 2022 10:40:00 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 852 times
Was thanked: 1155 time(s) in 1079 post(s)
Thanks for sharing this. I guess this attribute must have some kind of impact on the behaviour of the JIT. Do you have any information about the preview feature workaround you had in place? I'm trying to establish if this is an issue other users might also be experiencing. From the docs, it looks like this is an internal attribute that MS don't intend for developers to normally make use of.

Edit: Nevermind, I found it. We'll take a look at this. Thanks for bringing it up.
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.024 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download