The latest wwDotNetBridge.dll load is throwing the error - Unable to load wwDotNetBridge: Unable to load Clr instance.
I have reverted back to the 5.72 version with no ill effect as of yet.
Make sure you have .NET 4.5 or later installed.
Otherwise:
+++ Rick ---
I checked the registry on my computer. I'm at .NET 4.6.2 and I still get this error.
Sorry, I just noticed the link about CLR instance errors. I'll give that a look.
I finally traced this problem to the the following code, which must have been important a few years ago! Obviously, we don't want this now!!
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V2")
Yes.
I recommend:
- Always instantiate wwDotnetBridge during Application Startup w/ specific version
This forces the specific .NET runtime to be loaded at application startup and any subsequent requests will use that .NET version regardless of other setting you specify for the version in other instance creation calls.
loBridge = CREATEOBJECT("wwdotnetBridge","V4")
- Always use GetwwDotnetBridge() for getting references w/o a version number
Inside of the application then use the
GetwwDotnetBridge()
function to get a new instance of wwDotnetBridge. This function caches the instance used which makes it much faster to run .NET code especially if it's repeatedly loaded.
loBridge = GetwwDotnetBridge()
I have to admit I don't follow this advice myself all the time, but it's definitely good advice.
+++ Rick ---
Thank you. I'll update the notes I reference when I install a new version of Client Tools. Is there a spot in your release notes that will direct me to which .NET release is the best to use?
So, this code at application startup should be sufficeint?
*** Force .NET 4.0
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge = GetwwDotnetBridge()
Did you unblock the dll after dumping it into the application from the downloaded Zip file? Any downloaded dll from the Internet will flag otherwise.
There should be nothing special about the newer DLL other than it's compiled against .NET 4.52 which should make it work with any version of .NET 4.x and most definitely with newer versions (ie. your 4.6.2 which is the latest). I know it works here (on Windows 10).
Also make sure you're not loading V2 somewhere. In a cleanly loaded instance of the VFP IDE try:
DO wwDotnetBridge
loBridge = GetwwDotnetBridge("V4")
? loBridge.GetDotnetVersion()
which is the most reliable way to check for load failure. If that fails, you're either missing some component or the DLL is blocked.
+++ Rick ---
The dll has always been in an unblocked state. Once I got the code that forced .NET ver 2, everything is good.
Are you sure the DLL isn't blocked? Anything copied from a downloaded Zip file will be blocked and needs to be unblocked.
There should be no reason that the newer version should fail, especially if you are running 4.6.2 of .NET.
The best way to test:
- Start a new instance of the FoxPro IDE
- Change into your application folder
- Then:
DO wwDotnetBridge
loBridge = GetwwDotnetBridge("V4")
? loBridge.GetDotnetVersion()
If this fails, you're either missing DLLs, don't have the version you think you have installed, or the DLL is blocked.
If you have .NET 4.6.2 installed, "V4" should work just fine. How are you checking for .NET 4.6.2? It's not trivial to figure out exactly what version is installed as the runtime version number is 4.0. The build number determines what version is actually installed.
For 4.6.2 the build number should be 394802 or 394806.
+++ Rick ---