Web Connection
WwDotNetBridge problem
Gravatar is a globally recognized avatar based on your email address. WwDotNetBridge problem
  Dimitar
  All
  Jun 2, 2021 @ 01:53am

This issue is hard to be explained and mostly its hard to be reproduced but it happens almost on a daily basis.

A process starts and tries to load wwDotNetBridge, on Load() where this code executes:

lnDispHandle = ClrCreateInstanceFrom(FULLPATH("wwDotNetBridge.dll"),;
				"Westwind.WebConnection.wwDotNetBridge",@lcError,@lnSize)

sometimes we get an error saying

The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded.

I don't understand what may cause this issue since the process is freshly started from the ground up and nothing tries to load a different CLR version beforehand. It also can happen while debugging and when it does, even ClrUnload() doesn't help.

Is there a workaround?

Dimitar Hristov

Gravatar is a globally recognized avatar based on your email address. re: WwDotNetBridge problem
  Rick Strahl
  Dimitar
  Jun 2, 2021 @ 09:19am

Same machine each time? Each machine may have different runtime setups and if you're missing a .NET 4.62+ installation (on Win7 machines I would guess) you might get this failure.

If it's not a problem with the installed runtime, then it's that an explicit load of the Runtime fails. ie. v2.0 vs. v4.0 or .NET Core runtime. To be absolutely sure nothing else loads wwDotnetBridge you should call InitializeDotnetVersion() at the very start of your application and specify the runtime (ie v4 most likely). This will ensure that the initial call to Load fires before anything else has a chance to run and do something different.

One other thing: Make sure you're loading the same DLLs each and every time. Specifically wwIpStuff.dll and wwDotnetBridge.dll have to match - make sure that you're note accidentally getting a DLL from the SYSTEM folder or some other shared path that might override a local copy. When it fails, perhaps do a ? FULLPATH("wwdotnetbridge.dll") to see where they are loading from.

+++ Rick ---

© 1996-2024