Web Service Proxy Generator
Unable to load wwDotNetBridge: Unable to load Clr Instance - on first attempt only
Gravatar is a globally recognized avatar based on your email address. Unable to load wwDotNetBridge: Unable to load Clr Instance - on first attempt only
  Jon
  All
  Jun 14, 2018 @ 12:16pm

Hello,

I've got a VFP 9 SP2 web service that uses a proxy generated by the Web Service Proxy Generator to make calls to another third-party web service. Each time I call my web service method that makes the call to the other web service, I receive the error "Unable to load wwDotNetBridge: Unable to load Clr Instance. 0x8000ffff: Catastrophic failure", but only on the first attempt. On subsequent attempts, it loads fine and functions correctly. However, if I run IISRESET or if the service is idle for a while I get the error again on the first attempt, and then the subsequent attempts work correctly again. Any ideas as to why this would be happening?

Thanks,

Jon

Gravatar is a globally recognized avatar based on your email address. re: Unable to load wwDotNetBridge: Unable to load Clr Instance - on first attempt only
  Rick Strahl
  Jon
  Jun 14, 2018 @ 05:32pm

I'm going to take a guess here and posture that your app is maybe using regular COM interop somewhere? It sure sounds like the .NET runtime is trying to load multiple times and that's probably what's causing the catastrophic failure.

Unfortunately if that's the case there's no good way to test for that, but if you know it's happening you can use wwDotnetBridge through COM interop to instantiate on an already running runtime using the COM mode flag on the constructor. This does require that wwDotnetBridge is registered with COM Interop however.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Unable to load wwDotNetBridge: Unable to load Clr Instance - on first attempt only
  Jon
  Rick Strahl
  Jun 19, 2018 @ 07:21pm

That's correct. When I try calling the method like this:

loResult = loProxy.AuthorizeTransaction(lnStoreId, lcStoreKey, loTransaction, loOwnerApp)

I get the error "Method 'TransactionProcessing.TransactionProcessing.AuthorizeTransaction' not found...". When I call it like this, it works (I found this suggestion in another thread, in which you stated that COM handles some of the type conversions implicitly, if I remember correctly):

loResult = loProxy.oService.AuthorizeTransaction(lnStoreId, lcStoreKey, loTransaction, loOwnerApp)

I'd like to get it working the other way (COM-free), but I can't figure out why it won't work. Is there something special that I need to do in terms of the type conversions? I suspect it's something with the loTransaction object.

Jon

Gravatar is a globally recognized avatar based on your email address. re: Unable to load wwDotNetBridge: Unable to load Clr Instance - on first attempt only
  Rick Strahl
  Jon
  Jun 19, 2018 @ 07:55pm

No that's not what I'm talking about in terms of 'COM' call. You're just talking about using the proxy - which just proxies to the underlying object for you - vs. something that loads the .NET runtime outside of wwdotnetbridge. Is there something else that might be loading the .NET runtime?

Maybe make sure that wwDotnetBridge always loads the runtime first by doing InitializeDotnet() in the startup code of your application.

As to the proxy vs. the oService instance - I'm not sure why that wouldn't work. Yes there can be type passing differences as FoxPro will type cast certain types to specific types when passed as parameters. So a raw INT or Decimal can turn into number etc.

But it looks to me that the method signature does not have any parameters that would change. The only way to check is to step through - I'm guess the proxy call translates exactly into the same call you are making manually (unless it was changed).

What type is lnStoreId? You can try explicitly CAST(lnStoreId) but ints usually auto-convert and just work.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Unable to load wwDotNetBridge: Unable to load Clr Instance - on first attempt only
  Jon
  Rick Strahl
  Jun 21, 2018 @ 09:13pm

Hi Rick,

It turned out the problem was with loOwnerApp. I set it to NULL and then it started working (without giving the "Method 'TransactionProcessing.TransactionProcessing.AuthorizeTransaction' not found..." error) from a test script that I was running directly from VFP.

I still get the failures on the first attempt (and success on subsequent attempts) when it's called from the web service running on my Windows 10 box. However, I tested it against the web service on one of our Server 2012 R2 systems, and then on our customer's Server 2012 system, and both worked fine on the first try without any failures. So all is well.

Thanks,

Jon

© 1996-2024