-
-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermittent System.TypeLoadExceptions and System.Security.VerificationExceptions #1145
Comments
Hi @mrkaarel, thanks for reporting. We do need some kind of minimal repro code that exhibits this problem. Can you at the very least provide a full definition of one of the type/method definitions that the error message is about? Also, what platform do your CI builds run on (.NET TFM / OS / CPU architecture)? |
Thank you for a quick reply @stakx. So far we've been unsucessful isolating the issue to provide a minimal repro, the main reason being that it has only very rarely occurred on development machines. Here is a type declaration for
We are running our builds inside Docker container based on I understand if it is too vague, feel free to close this issue. I just put it out there in hope someone somewhere had already seen the same behaviour and found a solution. |
And you're saying the problem only started appearing after you upgraded to If you do manage to create a small repro solution — even if the error doesn't occur on every single run – then please post it. Let's leave this open for a while to see if anyone else is experiencing similar problems. |
I've searched for this issue and it seems you're not the only one who experienced this. Possibly related: dotnet/runtime#45600. |
Thank you for looking into it.
I have looked at the referenced dotnet/runtime issue before, but it seems different in a way that it has a specific repro that always fails whereas our problem only occurs sometimes (some race condition, or something else related to order things are executed?).
Yes, for us the issue started after the upgrade. Although during that upgrade there were many other notable changes as well – moving our builds + test runs to Docker, numerous NuGet package upgrades etc. As to exotic types being used – not really. Most of the code changes during that upgrade were related to infrastructure, "business" code, including the types causing the exceptions were in general not changed. I'll give it another try to isolate the issue. |
@mrkaarel, any news on this? |
@stakx Unfortunately no. After digging some more we have found that:
As we cannot get these exceptions to occur in IDE, I think one approach might be to log out some more details at the moment we catch one of those exceptions – I just can't think where to look. I guess, for now we will just start running this project's tests non-parallel until we get some new ideas what to try. |
This might be related to: #246 |
@BrunoJuchli, I cannot exclude that as a possibility; however, given that the issue reported here only surfaced after migrating to (Or at least I hope so. That other DynamicProxy issue was a beast. I'd hate to admit how much time I wasted trying to find its cause. 😆) |
@mrkaarel shall we close this issue? There's nothing we can do without a repro, really. That other runtime issue I linked to above has apparently been fixed, I'm wondering if the reported problem might go away after upgrading to the latest version of the .NET runtime? |
@stakx Yes, thank you for the patience, let's close this. For us the workaround was just to start running this project's tests non-parallel. I'll give it a quick try if anything has changed with the latest runtime. |
After upgrading our solution from .NET Core 2.1 to .NET 5 we have seen intermittent (about one failed run in every 6-7 build server test runs) System.TypeLoadExceptions and System.Security.VerificationExceptions with the following messages:
System.Security.VerificationException example:
System.TypeLoadException example:
The common part about all these exceptions is the error about violating the constraint of type parameter and that they are all related to mocks.
There are around 350 tests in total in which these exceptions have occurred. In a typical build there is either none of those exceptions or a relatively large amount (100-200), almost never just a few.
I have no reason to suspect a bug in Moq and I am just posting it here because I have run out of ideas what might be causing it and was hoping to find out if anyone else has seen such behaviour in their projects or based on these symptoms has a hunch what could be wrong.
The text was updated successfully, but these errors were encountered: