-
-
Notifications
You must be signed in to change notification settings - Fork 36
BUG: Dictionaries and arrays broken in latest release #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As a work around I changed the code to
where UnWrapType is a new method
That works, but as the unfortunate side effect that I need to go through all of my existing .NET Bridge calls to identify those that expect a .NET type to be returned instead of a wrapper. |
Alternatively, it appears to work if I change the fix up code for the instance parameter to
|
ComArray has an If you use For adding to dictionaries you'll want to use the new There's also an The latest, updated documentation is in the Web Connection docs at the moment as the Client Tools have not been updated with the latest wwDotnetBridge bits: ps. |
I get what you say, but that's not what the code does...
InvokeMethod and most other methods only use the Value property of ComValue. They are not using the corresponding values for ComArray or ComGuid. |
The fix up is performed on all parameters and result values, yes, but not the instance. I just never thought of why you would invoke on the ComArray, when you can invoke on It seems the way this probably could work is: internal object InvokeMethod_Internal(object instance, string method, params object[] args)
{
var fixedInstance = instance;
if (instance is ComValue)
fixedInstance = ((ComValue) instance).Value;
else if (instance is ComArray)
fixedInstance = ((ComArray)instance).Instance;
SetError(); Likewise for the GetProperty/SetProperty etc. Just thinking if this might break something else. Instance would still work, and it's unlikely you would actually invoke a method on the actual |
Because until a few weeks ago wwDotNetbridge did not return a ComArray for dictionaries when you called GetProperty. You made a breaking change here that requires me and others to go through all of our code and maybe even implement different cases for different versions of wwDotNetBridge. It might not look like this for you, because your recent update was the first one in two years and you probably used your new version for quite some time. But it's pretty new for everyone else. |
I think the above fix would fix the issue though as you could still pass back the ComArray... That would make the InvokeMethod(dict,"Add") work although you'd probably want to switch that to AddDictionary. I'm going to see about adding the I'll take a look tomorrow, but in the meantime you can probably try the fix above on your copy and see if that gets you past the initial breakage. |
wwDotNetBridge has become a crucial part of our day to day work with VFP. In the past three years all of my sessions at Virtual FoxFest used it. 😉
I tested the code in my third comment which just calls FixupParameter which is a superset of the the if lines. This worked just fine with my test cases. So yeah, your change should to the trick. It's replicated in many methods, though, not just InvokeMethod_Internal. |
Ah shit now I remember why no overloaded |
So made the changes and testing with this code: loList = loBridge.InvokeMethod(loNet,"GetDictionary")
? loBridge.ToString(loList)
? loList.Count && 2
loCust = loList.Item("Item1") && Retrieve item by Key
? loCust.Company
loCust.Company = loCust.Company + " " + TIME()
loCust = loList.CreateItem()
? loCust
loCust.Company = "North Wind Traders"
loList.AddDictionaryItem("Item3", loCust)
*** This should be your dictionary code? Works now
loBridge.InvokeMethod(loList,"Add","Item 4",loCust)
? lolist.Count Checking in as a separate branch for now until I can test better tomorrow. |
I've updated the code for the ComArray wrapping and pushed the latest changes into Master. I also updated the Client Tools docs to the latest version so that the new ComArray features are listed. The docs are now up to date with Web Connection and OSS versions, but out of sync with the actual Client Tools version (ugh). The only real difference is the dictionary and item handling so this is relatively minor and I'll update the Client Tools version next week. Thanks for your help. Let me know if there is still something that doesn't fix the backwards compatibility that might need further updates, but I think this should do the trick. |
I've the following code that works in the previous version of .NET bridge:
CefCommandLineArgs is a subclass of
Dictionary<String, String>
(https://github.com/cefsharp/CefSharp/blob/master/CefSharp/Internals/CommandLineArgDictionary.cs). Previously, GetProperty returned aCommandLineArgDictionary
instance.The new version returns a
Westwind.WebConnection.ComArray
object instead. Which wouldn't be an issue if InvokeMethod would transparently convert the value back to a Dictionary and call theAdd(String, String)
method. Instead InvokeMethod calls the Add method directly which fails, because there's no overload forAdd(String, String)
. As a result I end up with the error messageMethod 'Westwind.WebConnection.ComArray.Add' not found.
on the second line.
The text was updated successfully, but these errors were encountered: