West Wind .NET Tools and Demos
wwDotNetBridge Error: Type not loaded
Gravatar is a globally recognized avatar based on your email address. wwDotNetBridge Error: Type not loaded
  Phil Sherwood
  All
  Jan 25, 2018 @ 09:21am

On one deployment of our desktop app in the cloud, we get the wwDotNetBridge Error: Type not loaded error when it attempts to create a ComValue.

This is a cloud host that is using Windows 2012 to allow you to remote in and run the application. I have a test account and my install in the cloud works.

What could the cloud host not have configured correctly that we're getting this error?

Here's the code that gets the error:

loBridge   = CREATEOBJECT("wwDotNetBridge", "V4")
loValue = loBridge.CreateComValue()

We have the latest version of wwDotNetBridge.dll installed as well as wwIPStuff.dll.

I'm not sure what to tell the cloud host to check.

-Phil

Gravatar is a globally recognized avatar based on your email address. re: wwDotNetBridge Error: Type not loaded
  Rick Strahl
  Phil Sherwood
  Jan 25, 2018 @ 01:01pm

Not sure what that particular error means.

Make sure you have to the right versions of everything. Latest version of wwDotnetBridge.dll and wwipstuff.dll. Also, .NET 4.5 has to be installed on the server - I think 2012 still ships with 4.0 and 4.5 or later has to be explicitly installed.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: wwDotNetBridge Error: Type not loaded
  Phil Sherwood
  Rick Strahl
  Jan 25, 2018 @ 07:06pm

It has to be something with the server the cloud host set up. I've got a support ticket in with them waiting to see if .Net 4.5 is installed.

-Phil

Gravatar is a globally recognized avatar based on your email address. re: wwDotNetBridge Error: Type not loaded
  Phil Sherwood
  Phil Sherwood
  Jan 27, 2018 @ 08:24am

I called the GetHighestDotNetVersion function and it returns 4.0.30319 which is the version of .net that my test cloud server has and that server works.

The full error message is: wwDotNetBridge Error: Type not loaded. Please call LoadAssembly first.

What else should I check?

-Phil

Gravatar is a globally recognized avatar based on your email address. re: wwDotNetBridge Error: Type not loaded
  Rick Strahl
  Phil Sherwood
  Jan 28, 2018 @ 12:50am

When in doubt do this in FoxPro:

DO wwDotnetBridge 
loBridge = GetwwDotnetBridge("V4")
MessageBox(loBridge.GetDotnetVersion)

This will tell you if the app is able to load wwDotnetBridge just by itself.

FWIW the .NET Version for any version of .NET 4.0 will show that version which is fixed and will never change. The build number is what determines the actual version number.

But any version of .NET 4.0 and later should work, preferrably 4.5.2 and later and you definitely have that.

Specify the version number explicitly (ie. V4) and make very sure you have the right files from a common distribution (ie. wwipstuff and wwdotnetbridge as a matched set).

Here's more info: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: wwDotNetBridge Error: Type not loaded
  Phil Sherwood
  Rick Strahl
  Jan 28, 2018 @ 10:29am

Hey Rick,

Running that snippet of code returns

If I do

do wwDotNetBridge
GetHighestDotNetVersion()

it returns the 4.0.30319.

I'm specifiying the version "V4" in the creatobject of wwDotNetBridge. Why wouldn't it load the highest version?

-Phil

Gravatar is a globally recognized avatar based on your email address. re: wwDotNetBridge Error: Type not loaded
  Rick Strahl
  Phil Sherwood
  Jan 28, 2018 @ 07:56pm

Check your config file and make sure that you don't have an override in there for a specific version of .net.

yourApp.exe.config

or

vfp9.exe.config

Runtime version can be specifically specified in there and it will override whatever you use.

More info here:

GetHighestDotnetVersion() is old and no longer works reliably because they changed the way the runtimes are rev'd so that's not always reliable. If this is a desktop machine (ie. running desktop Windows) it might have the .NET 4.0 Client runtimes installed which existed only for 1 version. wwDotnetBridge can't load that one because it doesn't include some of the dependencies we load.

The best thing to do would be to install the latest version of .NET that you can get on the machine and see what happens.

+++ Rick ---

© 1996-2024