Verify that output produced by libraries build is valid IL
We should run additional checks to ensure the output we ship is actually valid IL. It can be done as an additional test configuration which would catch any problems in C# compiler or ILLinker which run during libraries build.
We could use in-repo available ilverify tool for this and this could also be a good test for the tool itself. Though the tool would need to implement #37391 first.
@jkotas
Tagging subscribers to this area: @safern, @viktorhofer See info in area-owners.md if you want to be subscribed.
Seems like a good idea, to help confirm the quality of the tools we're using on a large codebase. Related, @jaredpar was also discussing options for compiling dotnet/runtime as part of some CI leg in dotnet/roslyn.
I agree this is a good idea. We've done this in the past, for example when we added nullable annotations, we added some tests to make sure the compiler respected the NullablePublicOnly attribute we add to our assemblies to not preserve nullable metadata on non visible members outside of the assembly. Then, adding that attribute caused a regression in some of our shims and we added a test to make sure our shims only contain typeforwards.
https://github.com/dotnet/runtime/blob/5d702f87681f35cb019560075374346992bbde14/src/libraries/System.Runtime/tests/System/NullableMetadataTests.cs
Seems like a good idea, to help confirm the quality of the tools we're using on a large codebase.
Agree. The compiler team would love to use ilverify in the same way we use peverify today. Last time we looked into it though it seemed like there was still significant investment needed before we could use it. Has that changed?
Related, @jaredpar was also discussing options for compiling dotnet/runtime as part of some CI leg in dotnet/roslyn.
My goal here is to treat dotnet/runtime similar to how we treat Visual Studio. Essentially compile it once a day with the latest drop of dotnet/roslyn. That has struck a good balance with the Visual Studio repo and think it's the right spot for dotnet/runtime as well.
When I last checked, ILVerify is still missing support for some newer language features and requires additional investment to be useful. We'd love to have it for usage in Mono as well. cc: @MichalStrehovsky for the specifics
cc: @MichalStrehovsky for the specifics
Right, getting the tool running the way we need requires funding. It's weeks, up to months of work. ILVerify is pretty much a community project. It would need to be brought up to the management same as any other major feature work.
ILVerify benefits a lot from the fact that it's built on the same tech as crossgen2, but e.g. the default interface methods are not implemented in the shared managed type system. The impact of this missing on crossgen2 hasn't been significant enough to justify the work (crossgen2 can always just punt to the JIT). There will be bits and pieces like this, on top of adding the actual validation rules that are missing.
Here at Synergex, we use peverify on all of our Synergy/DE .Net Compiler tests. We are also Interested in having ILVerify do the same, albeit non verifiable code ( we don't generate 'safe' verifiable code). We find that we cant even ILVerify our C# generated runtime ( using code common to .NET framework) so there is a long way to go.