Repository navigation
How do I tell CsWin32 to generate a HResult style function. #1802
|
I'm trying to generate a HResult style version of GameInput.GetCurrentReading(), similar to the original signature. I need this because CsWin32 is generating a function that throws ComExceptions, and GameInput seems to be designed to fail for a while - maybe until it can connect devices internally. This is as far as I have gotten, and this is already at the end of a chain of failed suggestions by copilot... {
"$schema": "https://aka.ms/CsWin32.schema.json",
"public": true,
"generatorOptions": {
"PreserveSigMethods": [ "IGameInput::GetCurrentReading", "GetCurrentReading" ]
}
}Here's another suggestion... {
"$schema": "https://microsoft.github.io/CsWin32/schemas/1.0/NativeMethods.json",
"generatorOptions": {
"preserveSigMethods": true
},
"include": [
"IGameInput::GetCurrentReading" ]
}But I don't know how to deal with the schema part, there are two different schema. |
Replies: 2 comments
|
What about this CsWin32.json file... {
"$schema": "https://aka.ms/CsWin32.schema.json",
"public": true,
"comInterop": {
"preserveSigMethods": [
"GetCurrentReading"
]
}
}or this {
"$schema": "https://aka.ms/CsWin32.schema.json",
"className": "PInvoke",
"public": true,
"comInterop": {
"preserveSigMethods": [
"GetCurrentReading"
]
}
}This doesn't show any errors but it also doesn't work. |
|
I had to include the class/interface name, which seems to differ from examples. So, no idea what's going on there. But this does generate the HResult style function {
"$schema": "https://aka.ms/CsWin32.schema.json",
"comInterop": {
"preserveSigMethods": [
"IGameInput.GetCurrentReading"
]
}
} |
I had to include the class/interface name, which seems to differ from examples. So, no idea what's going on there. But this does generate the HResult style function
{ "$schema": "https://aka.ms/CsWin32.schema.json", "comInterop": { "preserveSigMethods": [ "IGameInput.GetCurrentReading" ] } }