ʃʈɑɲ
ʃʈɑɲ

Reputation: 2694

Using Thread.CurrentThread.ManagedThreadId in .Net Standard 1.2

I'm converting multiple PCL libraries to .Net Standard 1.2.
Reason I only convert to 1.2 is because we still need support for 8.1 and Windows Phone.

Here I'm running into a problem:

Thread.CurrentThread.ManagedThreadId;

My .csproj (in VS2017):

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard1.2</TargetFramework>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="System.Threading" Version="4.3.0" />
    <!--<PackageReference Include="System.Threading.Thread" Version="4.0.0" />-->
  </ItemGroup>
</Project>

It looks like there's only support starting from 1.3... https://www.nuget.org/packages/System.Threading.Thread/4.3.0

Alternatives?

Upvotes: 1

Views: 787

Answers (1)

Lex Li
Lex Li

Reputation: 63254

Switch to Environment.CurrentManagedThreadId,

https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.2_ref.md

Upvotes: 3

Related Questions