Replies: 4 comments 13 replies
-
Yes, we expect that AOT works with CsWin32-generated code. In fact WinForms in .NET 8 uses CsWin32 heavily. But for AOT support, your project should include a |
Beta Was this translation helpful? Give feedback.
-
If I create this project (.NET 8+AOT):
With a NativeMethods.txt file like this:
And a Program.cs like this:
Generation and compilation works fine, but at runtime, I get this error:
And I don't see how to fix this since the generated code doesn't use ComWrappers, or am I mistaken? |
Beta Was this translation helpful? Give feedback.
-
Ok thanks, it wasn't obvious looking at available documentation. For reference, I can have it work with this .csproj
NativeMethods.json:
And this code:
One last question: this code has now the requirement of being "fully unsafe", is there any way to make it generate IntPtr/managed interfaces instead of raw pointers? Something like this:
|
Beta Was this translation helpful? Give feedback.
-
Perhaps it would have been better for me to post this here: #1401. I'm struggling with getting the AOT/trim-safe mode working. I'm sure the end result is very simple but my lack of knowledge around COM is blocking me, and AI attempts to fix it aren't getting all the way to a working version either (maybe they are getting closer, impossible to tell) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
It's not clear to me what's the status of CsWin32 (in every aspect but I'm mostly interested in generated COM interfaces) vs AOT (I'm talking .NET8 and beyond https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net8plus%2Cwindows).
Is it supported (it doesn't seem it is but ...)?
If not, will it ever be? Any timeframe/roadmap?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions