Checking unsafe CIL for potential issues? #96594
Unanswered
FractalFir
asked this question in
Q&A
Replies: 1 comment
-
Related #37391. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! I am the creator of a project aiming to compile Rust code to .NET assemblies.
I have recently made some significant progress (I am able to compile most of the Rust standard library), and I would like to test the output of my Rust compiler backend better. My current tests involve running the resulting assemblies, and checking for crashes/exceptions. This is not ideal, since the .NET runtime quite often executes invalid CIL without raising exceptions.
This is an example of such invalid CIL:
This invalid IL will get executed by the .NET runtime, but is rejected by
mono
(it throws aSystem.InvalidProgramException
).I can't use mono for testing, since some Rust functionality requires usage of APIs not supported by
mono
.I would like to detect such invalid IL, because it signifies a bug within my compiler backend. Automatically catching such issues would make fixing bugs easier, since I would not have to debug the problematic assembly to try to find the problem.
I tried using
ilverify
for this purpose, but it has too many false positives. Assemblies I generate are unsafe, which causesilverify
to report a lot of errors related to unsafety. I tried ignoring specific error groups, but they are quite broad, which makes me unable to silence only false positives.The assemblies produced by my project tend to be sizable(13k methods, ~3mln lines of IL), so it is not feasible to check their correctness by hand.
This leads me to ask the following questions:
Thank you in advance for your help!
I would also like to clarify that I am aware that this is not a bug in the .NET runtime.
Beta Was this translation helpful? Give feedback.
All reactions