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
Error below occurs when trimming a proprietary and relatively complex Avalonia UI project. If further information is required for triage analysis, please mention me in discussion to arrange a private conversation.
MSBuild version 17.6.3+07e294721 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
...
Optimizing assemblies for size. This process might take a while.
ILLink : error IL1012: IL Trimmer has encountered an unexpected error. Please report the issue at https://github.com/do
tnet/linker/issues [C:\Users\sficke\source\repos\Winmark.DRS\Winmark.DRS.Frontend\Winmark.DRS.Frontend.csproj]
Fatal error in IL Linker
Unhandled exception. System.ArgumentException: Value does not fall within the expected range.
at Mono.Cecil.MetadataReader.GetMember[TMember](Collection`1 members, MetadataToken token)
at Mono.Cecil.MetadataReader.GetProperty(TypeDefinition type, MetadataToken token)
at Mono.Cecil.MetadataReader.ReadMethodSemantics(MethodDefinition method)
at Mono.Cecil.MetadataReader.ReadAllSemantics(TypeDefinition type)
at Mono.Cecil.MetadataReader.ReadAllSemantics(MethodDefinition method)
at Mono.Cecil.MethodDefinition.<>c.<ReadSemantics>b__27_0(MethodDefinition method, MetadataReader reader)
at Mono.Cecil.ModuleDefinition.Read[TItem](TItem item, Action`2 read)
at Mono.Cecil.MethodDefinition.ReadSemantics()
at Mono.Cecil.MethodDefinition.get_SemanticsAttributes()
at Mono.Linker.MethodDefinitionExtensions.IsPropertyMethod(MethodDefinition md)
at Mono.Linker.MethodDefinitionExtensions.TryGetProperty(MethodDefinition md, PropertyDefinition& property)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, MessageOrigin& origin
)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.Run(ILogger customLogger)
at Mono.Linker.Driver.Main(String[] args)
C:\Program Files\dotnet\sdk\7.0.304\Sdks\Microsoft.NET.ILLink.Tasks\build\Microsoft.NET.ILLink.targets(86,5): error NET
SDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to
false. [C:\...\MyProject\MyProject.csproj]```
The text was updated successfully, but these errors were encountered:
This can only fail like the above if the member in question can't be found. This would suggest potentially invalid IL, or IL with unresolvable tokens. Specifically this seems to fail because there's a method with a semantics record marking it as getter/setter for a property, but the property token which points to the property the method belongs to can't be resolved to a property on the same type.
Without providing us a repro, you might be able to attach a .NET debugger to the illink process and see what method is being processed when this happens. I would probably do something like:
Rerun the publish command which causes the failure with /bl to get msbuild binlog.
The task illink should have a command line which was executed to run the illink - copy that.
Run the command line under a .NET debugger and make it stop on all exceptions. Note that it's likely there will be exceptions before the one from this issue, so you may need to "continue" over those.
Once you're stopped on the right exception go up the stack to the MarkStep.ProcessMethod, the first parameter method should be the method in question (very likely the accessor which is problematic).
Once you have the affected method, I would use something like ilspy to open the IL and see if there's something wrong with it. You might also be able to tell where the method came from.
If you're comfortable providing us a repro (privately), please file a VS feedback item. That will let you upload the repro in such a way that only MS employees will see it.
Error below occurs when trimming a proprietary and relatively complex Avalonia UI project. If further information is required for triage analysis, please mention me in discussion to arrange a private conversation.
The text was updated successfully, but these errors were encountered: