Fix analyzer test generation for non-public Main#3151
Conversation
|
|
||
| [Fact] | ||
| public Task BaseProvidesInterfaceMethod () | ||
| public Task VarianceBasic () |
There was a problem hiding this comment.
Do we know why this happens? I do see that the VarianceBasic had a private Main method and is fine that we now have the Fact being generated. But why the BaseProvidesInterfaceMethod disappeared? And why there are no other tests? inside the Inheritance.Interfaces.StaticInterfaceMethods folder I see 10 files.
There was a problem hiding this comment.
The BaseProvidesInterfaceMethods and other tests besides VarianceBasic already exist in the non-generated StaticInterfaceMethods.cs. The generated BaseProvidesInterfaceMethod was left over even though the source generator is no longer generating it - and it wasn't being overwritten because it thought all of the testcases were already present (it doesn't generate a file with no facts in that case).
The ILLink analyzer testcase generator was generating extra testcases in dotnet/runtime, compared to linker. It turned out that in dotnet/linker, testcases with non-public Main methods were not getting generated, because the generator was getting a reference assembly for Mono.Linker.Tests.Cases.dll (which doesn't contain the non-public entry point), whereas dotnet/runtime has ref assembly generation turned off (so the analyzer was correctly discovering testcases based on the implementation assembly). This fixes the issue by turning off ref assembly generation for all projects except those specifically designed to be ref assemblies. The CompilerGeneratedCodeSubstitutions is disabled because it is not supported by the analyzer. Commit migrated from dotnet@c9ba21d
The ILLink analyzer testcase generator was generating extra testcases in dotnet/runtime, compared to linker. It turned out that in dotnet/linker, testcases with non-public Main methods were not getting generated, because the generator was getting a reference assembly for Mono.Linker.Tests.Cases.dll (which doesn't contain the non-public entry point), whereas dotnet/runtime has ref assembly generation turned off (so the analyzer was correctly discovering testcases based on the implementation assembly). This fixes the issue by turning off ref assembly generation for all projects except those specifically designed to be ref assemblies. The CompilerGeneratedCodeSubstitutions is disabled because it is not supported by the analyzer. Commit migrated from dotnet/linker@c9ba21d
In dotnet/runtime#79011 @tlakollo discovered that the ILLink analyzer testcase generator was generating extra testcases in dotnet/runtime, compared to linker. It turned out that in dotnet/linker, testcases with non-public Main methods were not getting generated, because the generator was getting a reference assembly for Mono.Linker.Tests.Cases.dll (which doesn't contain the non-public entry point), whereas dotnet/runtime has ref assembly generation turned off (so the analyzer was correctly discovering testcases based on the implementation assembly).
This fixes the issue by turning off ref assembly generation for all projects except those specifically designed to be ref assemblies.
The CompilerGeneratedCodeSubstitutions is disabled as in dotnet/runtime#79011.