-
Notifications
You must be signed in to change notification settings - Fork 89
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
STGMEDIUM is invalid under the new interface generation #197
Comments
Given the title of your issue, did this work with an older version? |
Well, when using structs you weren't calling into the classic marshaler, so the The problem is that you are now putting a marshaled .NET object into a union, which is something the classic marshaler doesn't allow (since it doesn't know when the union field is a reference to a .NET object and when its a plain value) Other unions like |
BTW you can turn off interface generation using the |
Yeah I noticed that but couldn't figure out what the option is. My Visual Studio is also terribly unhappy about something in the generator and throws several "gold bar" errors per minute once I start using the generator, so if the json schema is supposed to provide intellisense VS is probably too broken to deliver it at the moment. Anyways, as far as unions go, its not easy to fix. C is a language which only has dumb unions and the context for the union is provided outside in a containing struct or as a separate parameter (if the union is a function call parameter). This means the projection can either also be dumb, not projecting COM interfaces inside unions, using pointers instead and leave union handling and unpacking COM references to the caller; or it needs additional information to properly project unions, namely the context to disambiguate the union. When doing handwritten projections I usually lift the union API into its containing struct/class where the disambuation field is available, this typically matches the API just fine since often these are nested unions anyways which aren't supposed to be used as standalone types in the first place. It would probably be worth to do a study over the metadata package to see if all unions in the package have disambiguation information available in their direct usage site, and if not, classify the cases where the disambiguation data comes from somewhere else. If its always available in the direct usage site it would be worth adding metadata to the metadata package to describe how the container is disambiguating unions, allowing projections to generate higher quality APIs for unions. |
It is, if you have the There is a top-level property called |
Is there any update on this issue? I would like to be able to pass nulls at least. |
I haven't had a chance yet to circle back and improve the COM interface generation. The workaround I prescribe above still applies though. |
I went with a C++/WinRT app instead. As a beginner, it was easier to switch to C++ than turning off interface generation. Maybe I'll come back to C# when I know a bit more about COM. |
Duplicate of #292 |
My usual test for COM interop is to implement
IDataObject
, put it on the clipboard, and retrieve some data. I'm getting nowhere with this,STGMEDIUM
is incompatible with the classic marshaler and the runtime will fail interop calls.incomplete example code
Since this failed before I could write a complete test scenario my test code does not implement
IDataObject
sufficiently enough to actually retrieve data, .NET will fail before entering eitherGetData
orGetDataHere
. You can see one of the exceptions if you enable first chance exception and run above code:The text was updated successfully, but these errors were encountered: