Description
I'm working on porting one of my applications (Markdown Monster) to .NET Core 3.0 and it's going good except for my COM interop functionality that uses dynamic
to access various COM components inside of the Web Browser control.
Using raw Reflection instead of dynamic works, but it would be a lot of code in my case that has to be converted to make the Interop with with the more clumsy syntax and type casting.
Specifically I'm getting back objects from the Web Browser control and then use dynamic to call other functionality. All of that doesn't work with .NET Core. I previously mentioned this and at the time it looked like there was already work underway to make this work in 3.0, with no fixes scheduled for 2.x. I talked about this in a blog post here. The original discussion I referenced that mentioned fixes for 3.0 where in https://github.com/dotnet/corefx/issues/32630.
But now we're in 3.0 Preview and it's still not working.
Here's what I am doing:
// Get the JavaScript Ace Editor Instance
dynamic doc = WebBrowser.Document;
// fails
dynamic window = doc.parentWindow;
Replacing the code with manual reflection does work:
// this does
object window = ReflectionUtils.GetPropertyCom(doc, "parentWindow");
Status
There were previous issues open on this some time ago and at the time the word was that .NET Core 3.0 was going to fix this. It's not working on 2.x either at the time the call was won't fix for 2.x but will fix for 3.0.
Apparently it's not fixed in 3.0.
Is there any definite word on whether this will get addressed?
For me this is pretty big blocker in this app. I have tons of interop calls, and using dynamic is a key language feature that makes this code much more manageable (and also more performant due dynamic's internal caching etc) than using Reflection.
FWIW I already have an abstraction layer around the Editor/COM interop calls, but dynamic is such a core feature that it never occurred to me to abstract that further. I think if you want decent Windows Desktop support dynamic really should be working with COM objects.
Using latest .NET Core 3.0 Preview 4 SDK.