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

Handle TRUSTED_PLATFORM_ASSEMBLIES being an empty string to allow .NET5 single file deployments #6074

Merged
merged 1 commit into from
May 26, 2021

Conversation

andreasohlund
Copy link
Member

@andreasohlund andreasohlund commented May 26, 2021

Symptoms

Endpoints deployed using .net5.0 single file deployments fail on startup with:

System.ArgumentException: Empty path name is not legal. (Parameter 'path')
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at NServiceBus.AssemblyValidator.ValidateAssemblyFile(String assemblyPath, Boolean& shouldLoad, String& reason)
   at NServiceBus.Hosting.Helpers.AssemblyScanner.TryLoadScannableAssembly(String assemblyPath, AssemblyScannerResults results, Assembly& assembly)
   at NServiceBus.Hosting.Helpers.AssemblyScanner.GetScannableAssemblies()
   at NServiceBus.AssemblyScanningComponent.Initialize(Configuration configuration, SettingsHolder settings)
   at NServiceBus.HostCreator.CreateWithInternallyManagedContainer(EndpointConfiguration endpointConfiguration)
   at NServiceBus.Endpoint.Start(EndpointConfiguration configuration)

Who's affected

All users of NServiceBus v7.4 and below deploying their application as a single file.

Root cause

The assembly scanner assumes that AppDomain.CurrentDomain.GetData("TRUSTED_PLATFORM_ASSEMBLIES"); can't contain an empty string.

@andreasohlund andreasohlund changed the base branch from master to release-7.4 May 26, 2021 06:31
@andreasohlund andreasohlund modified the milestones: 7.4.6, 7.4.7 May 26, 2021
@andreasohlund andreasohlund changed the title Prevent loading assemblies when name is empty Do not try to load assemblies with no name May 26, 2021
@andreasohlund
Copy link
Member Author

I've tested the PR build locally and it solves the issue with single file deployments

@andreasohlund andreasohlund merged commit c8d7bd9 into release-7.4 May 26, 2021
@andreasohlund andreasohlund deleted the singlefile-net5 branch May 26, 2021 13:31
@andreasohlund andreasohlund changed the title Do not try to load assemblies with no name Handle TRUSTED_PLATFORM_ASSEMBLIES being an empty string May 26, 2021
@andreasohlund andreasohlund changed the title Handle TRUSTED_PLATFORM_ASSEMBLIES being an empty string Handle TRUSTED_PLATFORM_ASSEMBLIES being an empty string to allow .NET5 single file deployments May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants