Description
openedon Nov 30, 2020
as recommended in dotnet/runtime#45071 (comment) -->
Description
Windows Api "SetImageStreamAsync" broke with upgrade to .net5
It now throws an Exception --> 0x8001010E (RPC_E_WRONG_THREAD) after porting from .netcore3.1 to net5.0.
Reproduce the problem
https://github.com/aemarco/LockScreenTest.git
contains a sample project with nothing but the failing api call in App.xaml.cs.
It should be as easy as checking the repo out and run.
Working condition (netcore3.1)
By changing back to .netCore 3.1 as below, the lockscreen will get successfully set
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
Expectations
By specifying the TargetFramework with the windows version, api´s supposed to be functional.
Questions (done.... found concept reading stuff in https://github.com/dotnet/designs/tree/main/accepted/2020/minimum-os-version
Maybe you have a hint were to read up about that "define version number to access windows api" concept.
https://docs.microsoft.com/en-us/dotnet/standard/frameworks
explains that till the -windows, but not the part with the version number and api projections(which i learned through .netconf).
Should it not be possible to target "net5.0-windows", guard against specific api calls, dropping the "feature" when not on supported version, but call them if version >= needed ?