Closed JeremyKuhne closed 1 year ago
Very odd, because we do a full code generation with allow marshaling off in our automated tests and didn't hit this.
I can repro with a test. It's probably a regression from #738.
The compilation break is due to https://github.com/microsoft/win32metadata/issues/1367. I still don't understand how this bug is caught by a new, special purpose test but not caught in our catch-all full generation tests.
All methods are
[PreserveSig]
when "allowMarshalling" is false.
Hmmm... so you don't want specialname get_
and set_
methods to be declared as properties on structs?
Our 'full generation' test apparently skips at least some COM interfaces. 😲
Hmmm... so you don't want specialname get and set methods to be declared as properties on structs?
The question is what you do with HRESULT codes. As long as we have both so we can check them manually, I'm fine.
HRESULT codes. As long as we have both so we can check them manually, I'm fine.
@jeremykuhne C# properties cannot expose those. But we'll throw if they are error codes. Is that sufficient?
C# properties cannot expose those. But we'll throw if they are error codes. Is that sufficient?
The idea is that we can save the try .. catch
when we don't want to propagate an exception or deal with non-error return codes other than S_OK. There is also an issue of consistency in our interaction with the APIs.
And I wasn't thinking too clearly on this one. Clearly the issue is that you cannot have both because of the special name of getters and setters (the whole reason for the break here).
I'd say the minbar for me is that we can at least force some getters and setters to [PreserveSig]
when the need warrants. Given that things are partial we can work around things I suppose so it isn't completely blocking...
the minbar for me is that we can at least force some getters and setters to
[PreserveSig]
when the need warrants
The mechanism for that is the nativemethods.json file's list of preserveSigMethods
. I can make sure that can apply to properties.
@AArnott in the drop we currently have (0.2.98-beta) these were all generated as get_
& set_
.
Closing this as fixed given IPicture
now works.
Actual behavior
When generating
IPicture
we get the following errors in the latest build:It's generating the following:
It isn't doing
[PreserveSig]
, while the setter is. Maybe something to do with the introduction ofOLE_HANDLE
?Expected behavior
All methods are
[PreserveSig]
when"allowMarshalling"
isfalse
.Repro steps
NativeMethods.txt
content:NativeMethods.json
content:Context