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

Host throws assembly scanning errors preventing the endpoint from starting #571

Merged
merged 2 commits into from
Dec 9, 2022

Conversation

andreasohlund
Copy link
Member

@andreasohlund andreasohlund commented Dec 1, 2022

Symptoms

NServiceBus.Core: Could not load '{some assembly}'. Consider excluding that assembly from the scanning. System.Private.CoreLib: Assembly with same name is already loaded. is thrown at startup.

Who's affected

All customers using Version 4

Root cause

Since we run inside the azure functions host assemblies that we load and scan can be incompatible with versions referenced by the host.

Workaround

Manually exclude the problematic assemblies using:

public override void Configure(IFunctionsHostBuilder functionsHostBuilder)
{
    functionsHostBuilder.UseNServiceBus(endpointConfiguration =>
    {
        endpointConfiguration.AdvancedConfiguration.AssemblyScanner()
                .ExcludeAssemblies("some assembly");
    });
}

@andreasohlund andreasohlund self-assigned this Dec 1, 2022
@andreasohlund andreasohlund changed the title Exclude unscanable Microsoft.Identity.Client* dlls Exclude unscannable Microsoft.Identity.Client* dlls Dec 1, 2022
@WojcikMike WojcikMike marked this pull request as ready for review December 6, 2022 09:44
@andreasohlund andreasohlund changed the title Exclude unscannable Microsoft.Identity.Client* dlls Exclude unscannable assemblies Dec 9, 2022
@andreasohlund andreasohlund added this to the 4.0.1 milestone Dec 9, 2022
@andreasohlund andreasohlund changed the title Exclude unscannable assemblies Host throws assembly scanning errors on startup Dec 9, 2022
@andreasohlund
Copy link
Member Author

@SzymonPobiega @WojcikMike ready for final review

@andreasohlund andreasohlund merged commit 8d7d9ca into master Dec 9, 2022
@andreasohlund andreasohlund deleted the fix-scanning-bug branch December 9, 2022 10:23
andreasohlund added a commit that referenced this pull request Dec 12, 2022
* Exclude unscanable Microsoft.Identity.Client* dlls

* Exclude Azure.Storage.Blobs and Azure.Storage.Common
@SzymonPobiega SzymonPobiega changed the title Host throws assembly scanning errors on startup Host throws assembly scanning errors preventing the endpoint from starting Dec 13, 2022
@seanfarmar
Copy link

This workaround worked for us

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