'Unrecognized container: Transient' when loading NetServer Core using assembly loadfrom

lock
push_pin
done
Beantwoord
1

Hello,

I'm having an issue with the latest NetServer core release, when I reference the NuGet package directly and use the following code to bootstrap netserver, it works fine:

                var services = new ServiceCollection();
                services
                    .AddNetServerCore()
                    .AddSoDatabase()
                    .AddSingleton<Microsoft.Extensions.Logging.ILogger, SuperOffice.Logging.SoLogger>()
                    .AddSingleton<SuperOffice.Security.Principal.IContextInitializer, ContextInitializer>();

                var provider = services.BuildServiceProvider(true);
                provider.RegisterWithNetServer();

But when I reference the exact same NetServere Core package (and related packages) in a class library, use the code above to bootstrap netserver, and load it from a different application using Assembly.LoadFrom, I get the following error on the 'RegisterWithNetServer' line

 

We have all NetServer related code in a seperate class library, which is per SuperOffice version and we load according to the SuperOffice database version we are connected to. (Yes all legacy/technical debt, but can't just rewrite it all to the webapi package) This used to work fine with previous releases of NetServer but now broke with the change in bootstrapping/initilization.

Based on other results when searching the forum here, I think it is related to a missing assembly/dll, but when I compare the dll's when referencing the nuget package directly or through our class library setup, they are the same.

Does anyone have a few pointers/direction to help debug this?

 

23 nov 2022 | 09:48 a.m.

Alles Antwoorden (1)

23 nov 2022 | 09:48 a.m.
Thanks a lot for that hint, after implementing the AssemblyResolve event and loading the dependencies from the correct folder it all works great!
23 nov 2022 | 09:48 a.m.

Reply toevoegen