Core: PublishTrimmed on WPF Core 3 RC1 Could Not Load Type

Created on 19 Sep 2019  路  4Comments  路  Source: dotnet/core

When publishing WPF .net core 3 RC1 with PublishTrimmed I recieve the following edxception:
Could not load type Microsoft.CSharp.RuntimeBinder.Binder
Publishing the application without trimming works fine.

All 4 comments

The full error when publishing this WPF app is Could not load type 'Microsoft.CSharp.RuntimeBinder.Binder' from assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

Had to add 'TrimmerRootAssembly Include="Microsoft.CSharp"' to the proj file. Now the trimmed self contained exr works without error. Why is the reference dropped on trim?

@ericstj @joperezr can you help with this issue?

CC @eerhardt @sbomer for linker.
Looks like ILLink is missing usage of RuntimeBinder.Binder. I believe this is part of dynamic so I'm not surprised that the linker misses it. I suspect the linker would also miss any types you reference from dynamic code. For Microsoft.CSharp -- @jaredpar @cston @333fred

Was this page helpful?
0 / 5 - 0 ratings