MissingMetadataException: Can't seem to figure out where reflction is used

Shimmy Weitzhandler 246 Reputation points
2020-07-03T14:22:34.02+00:00

Hi,

I'm trying to run my app in release mode, and I get the following output when the program crashes:

Exception thrown: 'System.Reflection.MissingMetadataException' in System.Private.Reflection.Core.dll

This operation cannot be carried out because metadata for the following object was removed for performance reasons:\n\n EETypeRva:0x0002E180\n\nNo further information is available. Rebuild in debug mode for better information.\n\n

I think I covered all NuGet packages to the .rd.xml file and tried to be as inclusive as possible, and the issue still persists.
Is there a way to pin down the source of the error, i.e. the source that uses reflection? Is there any analyzer for this?

Here's what the .rd.xml file looks like:

xml
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
  <Application>
    <!--
      An Assembly element with Name="*Application*" applies to all assemblies in
      the application package. The asterisks are not wildcards.
    -->
    <Namespace Name="MyProject" Serialize="Required All" />
    <Namespace Name="MyProject.ViewModels" Serialize="Required All" />
    <Namespace Name="MyProject.Views" Serialize="Required All" />

    <!-- Add your application specific runtime directives here. -->
    <Assembly Name="Microsoft.Extensions.Hosting" Dynamic="Required All" />
    <Assembly Name="Microsoft.Extensions.Options" Dynamic="Required All" />
    <Assembly Name="Microsoft.Extensions.Logging" Dynamic="Required All" />
    <Assembly Name="Microsoft.Extensions.DependencyInjection" Dynamic="Required All" />
    <Assembly Name="Splat.Microsoft.Extensions.Logging" Dynamic="Required All" />
    <Assembly Name="Splat.Microsoft.Extensions.DependencyInjection" Dynamic="Required All" />
    <Assembly Name="CommonServiceLocator" Dynamic="Required All" />
    <Assembly Name="ReactiveUI" Dynamic="Required All" />
    <Assembly Name="ReactiveUI.Fody" Dynamic="Required All" />
    <Assembly Name="ReactiveUI.Uno" Dynamic="Required All" />
    <Assembly Name="Uno.Core" Dynamic="Required All" />
    <Assembly Name="Uno.Microsoft.Xaml.Behaviors.Uwp.Managed" Dynamic="Required All" />

    <Type Name="Microsoft.Extensions.Options.OptionsMonitor`1[TOptions]" Dynamic="Required All" />
    <Type Name="Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions" Dynamic="Required All"/>
  </Application>
</Directives>
Universal Windows Platform (UWP)
{count} votes