-
-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
The automatic Polyfill reference for legacy frameworks seems to have internal visibility, and TUnit can't access it.
$ dotnet run
/workspaces/repro/MyTests/obj/Debug/net481/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.CodeGenerators.DisableReflectionScannerGenerator/DisableReflectionScanner.g.cs(7,46): error CS0122: 'ModuleInitializerAttribute' is inaccessible due to its protection level
/workspaces/repro/MyTests/obj/Debug/net481/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.CodeGenerators.AssemblyLoaderGenerator/AssemblyLoader.g.cs(7,46): error CS0122: 'ModuleInitializerAttribute' is inaccessible due to its protection levelRepro steps (tested in WSL2 with Mono 6.12 / .NET 10 RC2 CLI for bootstrapping the project):
dotnet new console -o MyTests -f net10.0
dotnet add MyTests package TUnit
sed -i 's/net10.0/net481/g' MyTests/MyTests.csproj
sed -i '/<Nullable>enable<\/Nullable>/a \ <LangVersion>14</LangVersion>' MyTests/MyTests.csproj
rm MyTests/Program.cs
cat << 'EOF' > MyTests/MyTests.cs
namespace MyTests;
public class MyTests
{
[Test]
public async Task MyTest()
{
await Assert.That(true).IsTrue();
}
}
EOF
dotnet run --project MyTestsAs a workaround, I disabled the automatic polyfills and installed it manually:
sed -i '/<LangVersion>14<\/LangVersion>/a \ <EnableTUnitPolyfills>false</EnableTUnitPolyfills>' MyTests/MyTests.csproj
dotnet add MyTests package Polyfill
dotnet run --project MyTestsPhilippNaused
Metadata
Metadata
Assignees
Labels
No labels