TypeManager.TypeAssemblies error

Hi, im getting exactly the error described on the post below on a .net 4.7.2 service using a nuget/dll client proxy built on .net 2.0 standard use to call a Delphi Server.

This error DOES NOT happen in two development machines where we tested it. It only happens on two of our servers. Other services running exactly the same combination of nugets, frameworks and calling the same Delphi server work fine on the same machines.

The two servers are running on WSERVER2008R2ENT.

Anything I can look for? Also why is even required to call the TypeManager? is that something that is supposed to be done?

Ok, so I have more information.

We have a nuget that wraps the .net dlls for our services. It seems that one of the versions of the nuget did not include on its nuspec the libraries for both versions of .net (framework and standard/core) but only the .core/standard.

Inside the solution there are dlls that are set to be .net standard and some others to be .net 4.7.2 and somehow by not including both on the nuspec some issue was being caused and the error message will occured.

After adding both libraries and releasing a new nuget, the service is working now.

Hopefully anyone attempting to use .net standard clients will find this useful. Dont know the reasons of why it happened but at least there is hint on how it got solved.

Is this actually a fatal exception, or maybe just one that the debugger shows, but that’s caught? Can you post the complete call stack and error message? Thanx!

Hello

Most probably missing .nuspec metadata caused MSBuild to use the .NET Std-targeted assemblies instead on .NET FX or .NET Core ones.

The main difference in this case that caused the exception to appear was that .NET Standard assemblies use type resolving different from one used in .NET FX or .NET Core assemblies.

It can be narrowed down to

#if FULLFRAMEWORK || NETCORE
		IEnumerable<Assembly> domainAssemblies = AppDomain.CurrentDomain.GetAssemblies();
#else
		IEnumerable<Assembly> domainAssemblies = TypeManager.GetTypeAssemblies();
#endif

In other words, NET Std relies on manual registration of type assemblies in the TypeManager while other do use AppDomain.CurrentDomain to list assemblies.

The reason for this is that .NET Std was meant to be used on platforms where previously manual assembly registration was used.

We do have plans to finally unify the codepaths here, but we had to approach this with caution, otherwise a existing code can be broken (f.e. TypeManager).

For your convenience I’ll log the integration issue again and will link it to this topic, so you’ll see the progress on it.

1 Like

Thanks, logged as bugs://83073