Skip to content

0x8001010E (RPC_E_WRONG_THREAD) on Windows API call #612

Closed

Description

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions