Skip to content
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

Developers need a Package Compatible with .Net 5.0 preview 6+ #332

Closed
jtbrower opened this issue Jun 25, 2020 · 12 comments
Closed

Developers need a Package Compatible with .Net 5.0 preview 6+ #332

jtbrower opened this issue Jun 25, 2020 · 12 comments

Comments

@jtbrower
Copy link

Today I updated my 150 project .Net5.0 effort to preview version 6. There is a compatibility issue that prevents me from using the following SDK because an exception is thrown due to a missing method.

<PackageReference Include="Microsoft.Windows.SDK.NET" Version="10.0.18362.3-preview" />

System.MissingMethodException: Method not found: 'Void System.Runtime.InteropServices.ComWrappers.RegisterAsGlobalInstance()'.
   at WinRT.ComWrappersSupport.get_ComWrappers()
   at WinRT.ComWrappersSupport.CreateRcwForComObject(IntPtr ptr)
   at WinRT.MarshalInspectable.FromAbi(IntPtr ptr)
   at ABI.Windows.Devices.Enumeration.DeviceWatcher.FromAbi(IntPtr thisPtr)
   at ABI.Windows.Devices.Enumeration.IDeviceInformationStatics.CreateWatcher(String aqsFilter)
   at Windows.Devices.Enumeration.DeviceInformation.CreateWatcher(String aqsFilter)

I initially reported this issue over in the runtime repository 3 weeks ago but forgot to log it over here. It seems this could be related to this [runtime update] (dotnet/runtime#35318). Does your team have plans to release a compatible version soon?

@jkoritzinsky
Copy link
Member

The Microsoft.Windows.CsWinRT package has an update with the fix. Sadly, the team didn’t have a chance to push out a new version of Microsoft.Windows.SDK.NET that points to the updated Microsoft.Windows.CsWinRT package in time for the Preview 6 release.

@jtbrower
Copy link
Author

Hello @jkoritzinsky, that's certainly understandable, Microsoft is moving at an amazing (and fun) fast pace. Do you have an expected timeframe for that package? Its not blocking anything that I can't work-around for the moment but it would be great to have it in the next week.

@jkoritzinsky
Copy link
Member

You should be able to add a <PackageReference> directly to the Microsoft.Windows.CsWinRT package to get the updated version. I don't know the ETA on the updated SDK package. My guess would be when WinUI Preview 2 comes out, but I don't know for sure.

@jtbrower
Copy link
Author

Forgive any ignorance on my part regarding these questions as I am in control of a substantial amount of code and trying to remain an expert in all fast migrating repositories is a fun challenge to have.

Are you sure the latest Microsoft.Windows.CsWinRT preview has the updated fix? Adding a reference to it did not stop the original exception from being thrown. If I examine the Microsoft.Windows.SDK.NET package, it is indicating the same version of the latest Microsoft.Windows.CsWinRT package. I assumed that there was a newer Microsoft.Windows.CsWinRT version that would be used in place of the one that Microsoft.Windows.SDK.NET lists?

Latest Previews that I am Referencing

    <PackageReference Include="Microsoft.Windows.SDK.NET" Version="10.0.18362.3-preview" />
    <PackageReference Include="Microsoft.Windows.CsWinRT" Version="0.1.0-prerelease.200512.7" />

Is there another package feed that I need to add?

@jkoritzinsky
Copy link
Member

cc: @Scottj1s about pulling in the new CsWinRT NuGet package with the support for .NET 5 Preview 5+.

@jtbrower
Copy link
Author

@jkoritzinsky @Scottj1s that would be for .Net 5 Preview 6+. Preview 5 works fine.

@Scottj1s
Copy link
Member

Hi Jason, the function you mention was removed in Preview 5, and replaced with the pair of functions RegisterForTrackerSupport and RegisterForMarshalling. There's an unlisted cswinrt prerelease nuget that resolves this issue: https://www.nuget.org/packages/Microsoft.Windows.CsWinRT/0.1.0-prerelease.200623.5

@jtbrower
Copy link
Author

@Scottj1s sweet, thank you! I updated the version, booted up and connected to my target magnetic swipe reader. Cheers!

@Scottj1s
Copy link
Member

We will be publishing a listed cswinrt nuget with this fix (and a few others) in sync with the WinUI 3 Preview 2 release (soon).

@jtbrower
Copy link
Author

@Scottj1s since you brought up WinUI 3 I thought I would mention that I gave preview 1 WinUI a try over the weekend and was pleased that I could build a desktop application using it. I applied the same fix that you shared above so that it would work with .Net5.0 preview 6. "Dying" for a new way forward regarding UI in Desktop applications I think I am going to attempt to convert a substantial amount of WPF over. Although I know this topic is outside the scope of the repo, thanks for your fix because it gives me the ability to use the latest .Net while continue to evaluate other packages like WinUI.

@raffaeler
Copy link

raffaeler commented Sep 21, 2020

I have this same error with RC1 and didn't expect at this time in a Console App that is just consuming WinSDK:

<PackageReference Include="Microsoft.Windows.SDK.NET" Version="10.0.18362.3-preview" />

Is there a fix right now? @Scottj1s

TIA

@raffaeler
Copy link

Forget it, I came back to the nuget package after getting an access denied, which is caused by the location privacy settings instead.
It works, sorry for the confusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants