question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AssemblyFinder throw Exception in .Net5.0(RC2) SingleFile

See original GitHub issue

Unhandled exception. System.NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle. at System.Reflection.RuntimeAssembly.get_CodeBase() at Microsoft.Extensions.DependencyModel.DependencyContextLoader.GetNormalizedCodeBasePath(Assembly assembly) at Microsoft.Extensions.DependencyModel.DependencyContextLoader.GetDepsJsonPath(Assembly assembly) at Microsoft.Extensions.DependencyModel.DependencyContextLoader.LoadAssemblyContext(Assembly assembly, IDependencyContextReader reader) at Microsoft.Extensions.DependencyModel.DependencyContextLoader.Load(Assembly assembly) at Microsoft.Extensions.DependencyModel.DependencyContext.Load(Assembly assembly) at Microsoft.Extensions.DependencyModel.DependencyContext.LoadDefault() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at System.Lazy1.get_Value() at Microsoft.Extensions.DependencyModel.DependencyContext.get_Default() at Serilog.Settings.Configuration.Assemblies.AssemblyFinder.Auto() at Serilog.ConfigurationLoggerConfigurationExtensions.Configuration(LoggerSettingsConfiguration settingConfiguration, IConfiguration configuration, String sectionName, DependencyContext dependencyContext) at Serilog.ConfigurationLoggerConfigurationExtensions.Configuration(LoggerSettingsConfiguration settingConfiguration, IConfiguration configuration, DependencyContext dependencyContext) at HostApp.Program.<>c.<CreateHostBuilder>b__1_2(WebHostBuilderContext hosting, LoggerConfiguration logger) at Serilog.SerilogWebHostBuilderExtensions.<>c__DisplayClass1_0.<UseSerilog>b__0(WebHostBuilderContext context, IServiceCollection collection) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass11_0.<ConfigureServices>b__0(HostBuilderContext context, IServiceCollection builder) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at HostApp.Program.Main(String[] args)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
nathanpovocommented, Dec 29, 2020

Another workaround is to set IncludeAllContentForSelfExtract to true when publishing. Setting this property to true changes the .NET 5.0 system of single-file apps to be backward compatible with the .NET Core 3.x system (as described here).

I have tested this with version 3.2.0-dev-00264 of Serilog.Settings.Configuration and it works; version 3.1.0 will not work.

Some additional info on the workaround can be found here - https://github.com/dotnet/runtime/issues/44511#issuecomment-725253197 Related issue - https://github.com/dotnet/runtime/issues/42265

1reaction
murugarathamcommented, Nov 18, 2020

Seems working fine and I feel dumb

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy as single-file in .net5 with log4net throws exception ...
Trying to deploy a console-application written in .Net 5 with log4net as a single-file. Running deployed application throws exception.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found