HtmlSanitizer
HtmlSanitizer copied to clipboard
[Blazor, .NET5] When publishing webassembly app with trimming enabled an error IL1012 is thrown
Hi, I encounter an issue with your assembly that when I publish my project with reference to your package during PublishTrimming stage an error is being thrown.
This app is Blazor client-side in .NET5
What does the error message say? Can you provide steps to repro?
Hi, here is exception:
ILLink : error IL1012: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues [BlazorApp2\BlazorApp2.csproj]
Fatal error in IL Linker
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'input')
at System.Text.RegularExpressions.ThrowHelper.ThrowArgumentNullException(ExceptionArgument arg)
at System.Text.RegularExpressions.Regex.Matches(String input)
at Mono.Linker.Steps.MarkStep.MarkTypeWithDebuggerDisplayAttribute(TypeDefinition type, CustomAttribute attribute)
at Mono.Linker.Steps.MarkStep.MarkTypeSpecialCustomAttributes(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet`1 typesAlreadyVisited)
at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet`1 typesAlreadyVisited)
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
at Mono.Linker.Steps.MarkStep.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.Main(String[] args)
you just need to create a new blazor-client-side app from template and add reference for you nuget. Than when you call:
dotnet publish -c Release -o build
you will notice an issue.
I'm attaching BlazorApp2.zip
I can't repro. I've tried the attached project and a fresh one created from the template in VS 2019. Published through VS and command line.
Hi, @mganss on Mono
repository https://github.com/mono/linker/issues/1648#issuecomment-733898392 it mentioned that it will be addressed.