mosa/MOSA-Project

Compiler cannot compile `System.Runtime.CompilerServices.NullableAttribute`

jvyden opened this issue · 2 comments

jvyden commented

When trying to compile a project containing a file with #nullable enable or a project declaring <Nullable>enable</Nullable> in it's csproj, the compile will consistently fail.

The error produced:

0.23 | Compiling: /home/jvyden/Documents/MOSANullReproduction/MOSANullReproduction/bin/MOSANullReproduction.dll
0.24 | Exception: Mosa.Compiler.Common.Exceptions.AssemblyLoadException: Assembly Load Exception
   at Mosa.Compiler.MosaTypeSystem.CLR.Metadata.ClrMetadataResolver.ResolveCustomAttributes(MutatorBase unit, IHasCustomAttribute obj)
   at Mosa.Compiler.MosaTypeSystem.CLR.Metadata.ClrMetadataResolver.ResolveField(MosaField field)
   at Mosa.Compiler.MosaTypeSystem.CLR.Metadata.ClrMetadataResolver.Resolve()
   at Mosa.Compiler.MosaTypeSystem.CLR.Metadata.ClrMetadata.LoadMetadata()
   at Mosa.Compiler.MosaTypeSystem.TypeSystem.Load()
   at Mosa.Compiler.MosaTypeSystem.TypeSystem.Load(IMetadata metadata, ITypeResolver typeResolver)
   at Mosa.Compiler.Framework.MosaCompiler.Load()
   at Mosa.Utility.Launcher.Builder.Compile()
   at Mosa.Utility.Launcher.Builder.Build()

I've created a project based on MOSA 2.4.0.900 that reproduces the issue: https://github.com/jvyden/MOSANullReproduction

Here's the project's Program.cs in SharpLab (with the compiled NullableAttribute shown): https://sharplab.io/#gist:ada639343d1664804d88342291d5c8a2

Thanks for reporting this.

The issue has been resolved. Again, thanks for reporting this!