You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Improve error experience for invalid descriptor files #653
Adding something invalid in a linker descriptor file will cause the ILLink task to report an exit code and not much else when used as part of dotnet publish.
The real error isn't great and is buried in higher verbosity logs.
Fatal error in IL Linker
Unhandled Exception: Mono.Linker.Steps.XmlResolutionException: Failed to process XML description: <unspecified> ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Mono.Linker.LinkContext.ResolveReferences(AssemblyDefinition assembly)
at Mono.Linker.Steps.ResolveFromXmlStep.ProcessAssemblies(LinkContext context, XPathNodeIterator iterator)
at Mono.Linker.Steps.ResolveFromXmlStep.Process()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.ResolveFromXmlStep.Process()
at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.Run(ILogger customLogger)
at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
at Mono.Linker.Driver.Main(String[] args)
Errors
This is a failure during _RunILLink task, the current command line adds as ExtraArgs -out "obj\Debug\netcoreapp3.0\win10-x64\linked" -c copyused -u copyused -l none --skip-unresolved true eventually code fails during Assembly Resolution with an AssemblyResolutionException (AssemblyResolver.cs) instead of throwing an error since --skip-unresolved flag was active, a warning message is printed stating that we couldn't resolve the assembly followed by the name of the skipped assembly (a much more useful warning message). Once again, this message is not being printed in the console since an additional --verbose flag needs to be passed to the _RunILLink task in order to print these warning statements.
Then second issue is that, after the AssemblyResolutionException has been handled, we return the assembly as null, later on in LinkContext.cs gets operated generating the System.NullReferenceException. This generates two problems, one is that this is not what we expect, we are expecting to skip the assembly, therefore there should be no failure. Second, independent of the error Standard Error does not have enough verbosity to be printed. No matter where do we fail or what the failure is, it's not going to be printed.
So the fix has the following:
Increase Standard Error output logging importance so default verbosity is able to print it
Add additional warning if there is a suspicious character on the assembly name (usage of ', :, #, @, !, etc.). This may enter into discussion since ECMA-335 says that all unicode standard 3.0 characters are supported in assembly names, so if a library is called 'System.Resources.ResourceManager is actually going to load it (we tested some ♫☺☼╠.dll and was able to load). Still this warning message it's only going to be printed if we fail to load the assembly, trying to help the user to find what's wrong.
Change code to really skip the assembly and not to fail with System.NullReferenceException
Change verbosity of the _RunILLink task to include --verbose (notice that this change is not on the linker repo, therefore an additional commit will fix it in sdk repo)
Activity
tlakollo commentedon Aug 23, 2019
This is a failure during _RunILLink task, the current command line adds as ExtraArgs
-out "obj\Debug\netcoreapp3.0\win10-x64\linked" -c copyused -u copyused -l none --skip-unresolved trueeventually code fails during Assembly Resolution with an AssemblyResolutionException (AssemblyResolver.cs) instead of throwing an error since--skip-unresolvedflag was active, a warning message is printed stating that we couldn't resolve the assembly followed by the name of the skipped assembly (a much more useful warning message). Once again, this message is not being printed in the console since an additional--verboseflag needs to be passed to the _RunILLink task in order to print these warning statements.Then second issue is that, after the AssemblyResolutionException has been handled, we return the assembly as null, later on in
LinkContext.csgets operated generating theSystem.NullReferenceException. This generates two problems, one is that this is not what we expect, we are expecting to skip the assembly, therefore there should be no failure. Second, independent of the error Standard Error does not have enough verbosity to be printed. No matter where do we fail or what the failure is, it's not going to be printed.So the fix has the following:
'System.Resources.ResourceManageris actually going to load it (we tested some♫☺☼╠.dlland was able to load). Still this warning message it's only going to be printed if we fail to load the assembly, trying to help the user to find what's wrong.Improve Error Experience