Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SampleWebApi sample crashes with MissingRuntimeArtifactException #7169

Closed
jkotas opened this Issue Mar 14, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@jkotas
Copy link
Member

jkotas commented Mar 14, 2019

Repro:

cd Samples\WebApi
dotnet publish -c Release -r win-x64
bin\x64\Release\netcoreapp2.1\win-x64\publish\SampleWebApi.exe

Result:

Unhandled Exception: EETypeRva:0x01468718(System.Reflection.MissingRuntimeArtifactException): This object cannot be invoked because it was metadata-enabled for browsing only: 'Microsoft.Extensions.Logging.Configuration.LoggerProviderConfiguration<Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider>..ctor(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfigurationFactory)' For more information, please visit  http://go.microsoft.com/fwlink/?LinkID=616867
   at Internal.Reflection.Core.Execution.ExecutionEnvironment.GetMethodInvoker(RuntimeTypeInfo, QMethodDefinition, RuntimeTypeInfo[], MemberInfo) + 0x148
   at System.Reflection.Runtime.MethodInfos.NativeFormat.NativeFormatMethodCommon.GetUncachedMethodInvoker(RuntimeTypeInfo[], MemberInfo) + 0x50
   at System.Reflection.Runtime.MethodInfos.RuntimePlainConstructorInfo`1.get_UncachedMethodInvoker() + 0xa1
   at System.Reflection.Runtime.MethodInfos.RuntimePlainConstructorInfo`1.Invoke(BindingFlags, Binder, Object[], CultureInfo) + 0x65
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite, ServiceProviderEngineScope) + 0x9e
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite, ServiceProviderEngineScope) + 0x62
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite, ServiceProviderEngineScope) + 0x6b
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite, ServiceProviderEngineScope) + 0x62
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite, ServiceProviderEngineScope) + 0x52
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite, ServiceProviderEngineScope) + 0x6b
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite, ServiceProviderEngineScope) + 0x16
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite, ServiceProviderEngineScope) + 0x6b
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite, ServiceProviderEngineScope) + 0x62
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite, ServiceProviderEngineScope) + 0x6b
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite, ServiceProviderEngineScope) + 0x62
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite, ServiceProviderEngineScope) + 0x52
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite, ServiceProviderEngineScope) + 0x6b
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite, ServiceProviderEngineScope) + 0x62
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite, ServiceProviderEngineScope) + 0x6b
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite, ServiceProviderEngineScope) + 0x62
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider, Type) + 0x5e
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider) + 0x29
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() + 0xd1
@jkotas

This comment has been minimized.

Copy link
Member Author

jkotas commented Mar 14, 2019

MichalStrehovsky added a commit to MichalStrehovsky/corert that referenced this issue Mar 15, 2019

Fix protocol between UsageBased and AnalysisBased metadata managers
In dotnet#7042 I made it possible to express reflectability of something purely based on canonical code presence (so if e.g. `Foo<__Canon>..ctor` is compiled, `Foo<__Canon>..ctor` should be considered reflectable). Previously we only considered reflectability of concrete instantiations.

This was not reflected in the protocol between usage based and analysis based metadata managers: usage based manager was forgetting to tell the analysis based metadata manager about canonical bodies. As a result, places that relied on marking canonical bodies to make things reflectable (such as RD.XML and `--rootallapplicationassemblies`) were not getting that behavior when IL scanner was involved (optimized builds).

Fixes dotnet#7169.

MichalStrehovsky added a commit that referenced this issue Mar 15, 2019

Fix protocol between UsageBased and AnalysisBased metadata managers (#…
…7171)

In #7042 I made it possible to express reflectability of something purely based on canonical code presence (so if e.g. `Foo<__Canon>..ctor` is compiled, `Foo<__Canon>..ctor` should be considered reflectable). Previously we only considered reflectability of concrete instantiations.

This was not reflected in the protocol between usage based and analysis based metadata managers: usage based manager was forgetting to tell the analysis based metadata manager about canonical bodies. As a result, places that relied on marking canonical bodies to make things reflectable (such as RD.XML and `--rootallapplicationassemblies`) were not getting that behavior when IL scanner was involved (optimized builds).

Fixes #7169.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.