-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Specified cast is not valid while using as WinRT server on net8.0 #19
Comments
Yeah, the server components highly rely on the built in COM/WinRT marshaling. I've started working on support for "modern" .NET code but it's not working yet. |
I got the COM Server working on modern .NET. Working on WinRT server now |
Ok, @hez2010 try using https://github.com/shmuelie/Shmuelie.WinRTServer/pkgs/nuget/Shmuelie.WinRTServer/158852442 and if that works, I'll prepare a full release for nuget.org |
Hello, thanks for the investment into modern .net support for WinRT. I tested it with a simple test project https://github.com/hez2010/WinRTServerTest but unfortunately it still failed with Is there anything I'm missing in the test project? |
I suspect this is an issue from CsWinRT as I hit the same exception while using |
Ok, I looked at your test project and you're missing the Metadata and interface projects that my sample shows. I admit having them is a pain but I haven't been able to get away from them yet |
I see. I just added the interface and metadata projects but still with no luck. |
The |
Still no luck even if with a |
The |
Still not working even with |
@hez2010 if that doesn't work, could you see if the test projects in the |
I changed my client from net8.0 to net481 while kept the server project net8.0 and this time it works as expected. |
That is very weird as Shmuelie.WinRTServer.Sample.WpfNet6Client worked for me with the WinRT Activation of a .NET 8 server. |
Yeah, it's very weird as your sample also works for me... Here is the repro: https://github.com/hez2010/WinRTServerRepro |
It turns out to be my fault that I didn't copy the winmd files next to the client exe. Anyway, a big thanks for your work, and feel free to close this issue and release the new package :) |
Nice. I'll try to make some improvements to the documentation first but awesome! |
@hez2010 version 1.2.0 published to nuget! |
Hello, thanks for the project.
I'm trying to use it to create a WinRT server with CsWinRT to run on net8.0, and here is the project I'm using for testing: https://github.com/hez2010/WinRTServerTest
I copy-pasted your library code because in net8.0 the
IActivationFactory
interface type will fail to load, so I removed the: IActivationFactory
fromBaseActivationFactory
.The
ActivationFactory
can be created successfully, but when activating the classTestClass
, it failed to cast the managed object (an instance ofTestClass
) toIInspectable
atunkwnPtr.CopyTo(instance)
inBaseActivationFactoryProxy.ActivateInstance
withSpecified cast is not valid.
.Shmuelie.WinRTServer/src/Shmuelie.WinRTServer/Internal/BaseActivationFactoryProxy.cs
Line 233 in 8bfa82e
The text was updated successfully, but these errors were encountered: