-
Notifications
You must be signed in to change notification settings - Fork 470
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 VerificationException 'violates the constraint of type parameter...' #680
Comments
There's really not a lot we can do without any repro code example, sorry. Can you try to reduce your actual code to something more minimal that you could share with us? It doesn't matter if it does not repro the error in 100% of all runs, if it is known to repro the issue every so often that'd be good enough.
If your code can be made to run on the .NET Framework, you can save the generated assembly to disk (using a If your code only runs on .NET Core (5+) then that won't work. Perhaps you could get at the generated code using the unmanaged profiling API somehow. I don't know much about that unfortunately. |
Thank your for the feedback. We will let you know when we have repro code. Since it is somehow dependent on the load/multithreading (as we suspect) it's hard to catch. |
One more thought: make sure that there aren't two types with the same name but from different assemblies involved (one being used in the generic type constraint definition, the other being used as the generic type argument). |
Thank you for the idea @stakx. I had a look if we have duplicate names over multiple assemblies, but this doesn't seem to be the case. |
Although we were still unable to reproduce this issue in an example code, I would like to add more details here: The exception mentions generic type parameter that doesn't exist in a contract of a factory interface, for example: similar example is: We are using Castle.Core 4.4.1. |
@OliverMacko, does your code involve anything else involving a generic type parameter called |
yes there are proxied factories that use TEntity type parameter in some of their methods but there is no direct relation between them and this IOperationFactory (first example). They do exist in the same assembly (project), but they are not part of the same type hierarchy. |
In our software we are experiencing
VerificationExceptions
of this kind:System.Security.VerificationException : Method Castle.Proxies.[some method] type argument '[some type]' violates the constraint of type parameter 'Txxx'
We tried to get hold of the generated proxies to analyze what is generated and why this exception occurs but didn't find a way yet on how to get the JITted code.
We got so far that we proofed the constraints are met but the exception is still thrown. This leads us to the conclusion that something is generated in the wrong way within Castle.Core.
We tried to have an example to reproduce this issue but didn't find a way to do so yet. The only source we have is our software running on different computers and experiencing this issue from time to time and in the last weeks more often. Restarting the software helps to get the system back to running.
Components used:
Questions:
Looking forward to bring some light into this issue.
The text was updated successfully, but these errors were encountered: