Skip to content

EFCore Service Connector not usable when published single file #984

@thompson-tomo

Description

@thompson-tomo

Summary

I am producing a dotnet core web application using the EFCore service connector to manage db connection string however when i publish it with PublishSingleFile=true, the application fails to launch.

It is a part of our organisation architecture directives that all dotnet core apps must be published as a single file and as such i don't want to move away from that. At the same time i don't want to stop using steeltoe as i am wanting to rollout more steeltoe functionality as time allows.

Stack Trace

File path path information for the assembly containing ServiceInfoCreatorAssemblyAttribute is missing. Some Steeltoe functionality may not work with PublishSingleFile=true
Unhandled exception. System.IO.FileNotFoundException: Could not find core assembly. Either specify a valid core assembly name in the MetadataLoadContext constructor or provide a MetadataAssemblyResolver that can load the core assembly.
at System.Reflection.TypeLoading.CoreTypes..ctor(MetadataLoadContext loader, String coreAssemblyName)
at System.Reflection.MetadataLoadContext..ctor(MetadataAssemblyResolver resolver, String coreAssemblyName)
at Steeltoe.Common.Reflection.ReflectionHelpers.TryLoadAssembliesWithAttributeT
at Steeltoe.Common.Reflection.ReflectionHelpers.FindAssembliesWithAttributeT
at Steeltoe.Common.Reflection.ReflectionHelpers.FindTypeFromAssemblyAttributeT
at Steeltoe.Connector.ServiceInfoCreatorFactory.GetServiceInfoCreator(IConfiguration configuration)
at Steeltoe.Connector.IConfigurationExtensions.GetServiceInfos[TServiceInfo](IConfiguration configuration)
at Steeltoe.Connector.IConfigurationExtensions.GetSingletonServiceInfo[TServiceInfo](IConfiguration config)
at Steeltoe.Connector.SqlServer.EFCore.SqlServerDbContextOptionsExtensions.GetConnection(IConfiguration config, String serviceName)
at Steeltoe.Connector.SqlServer.EFCore.SqlServerDbContextOptionsExtensions.UseSqlServer(DbContextOptionsBuilder optionsBuilder, IConfiguration config, Object sqlServerOptionsAction)
at Skidata.Dashboard.Manager.Program.<>c__DisplayClass1_1.b__4(DbContextOptionsBuilder options) in C:\Users\thja\Documents\Repos\Dashboard.Server\Dashboard.Logic-Web\Dashboard-Web\Program.cs:line 42
at Skidata.Dashboard.Service.DashConfigurationProvider.Load() in C:\Users\thja\Documents\Repos\Dashboard.Server\Dashboard.Logic-Web\Dashboard-Web_Lib\Service\DashConfigurationProvider.cs:line 92
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList1 providers) at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration() at Microsoft.Extensions.Hosting.HostBuilder.Build() at Skidata.Dashboard.Manager.Program.Main(String[] args) in C:\Users\thja\Documents\Repos\Dashboard.Server\Dashboard.Logic-Web\Dashboard-Web\Program.cs:line 31

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions