Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Microsoft.Extensions.AmbientMetadata</RootNamespace>
<TargetFrameworks>$(NetCoreTargetFrameworks);netstandard2.0;net462</TargetFrameworks>
<Description>Runtime information provider for application-level ambient metadata.</Description>
<Workstream>Telemetry</Workstream>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Microsoft.Extensions.DependencyInjection</RootNamespace>
<TargetFrameworks>$(NetCoreTargetFrameworks);netstandard2.0;net462</TargetFrameworks>
<Description>Extensions to auto-activate registered singletons in the dependency injection system.</Description>
<Workstream>Fundamentals</Workstream>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Microsoft.Extensions.Diagnostics</RootNamespace>
<TargetFrameworks>$(NetCoreTargetFrameworks);netstandard2.0;net462</TargetFrameworks>
<Description>Provides canonical implementations of telemetry abstractions.</Description>
<Workstream>Telemetry</Workstream>
<!-- disable "Published symbols cannot be deleted to maintain compatibility" because we have different APIs for different TFMs -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;
using System.Linq;
#if !NETFRAMEWORK
#if !NETFRAMEWORK && !NETSTANDARD
using System.Security.Cryptography;
#endif
using Microsoft.Extensions.Logging;
Expand All @@ -22,7 +22,7 @@ internal sealed class RandomProbabilisticSampler : LoggingSampler, IDisposable
{
internal RandomProbabilisticSamplerFilterRule[] LastKnownGoodSamplerRules;

#if NETFRAMEWORK
#if NETFRAMEWORK || NETSTANDARD
private static readonly System.Threading.ThreadLocal<Random> _randomInstance = new(() => new Random());
#endif

Expand Down Expand Up @@ -50,7 +50,7 @@ public override bool ShouldSample<TState>(in LogEntry<TState> logEntry)
return true;
}

#if NETFRAMEWORK
#if NETFRAMEWORK || NETSTANDARD
return _randomInstance.Value!.Next(int.MaxValue) < int.MaxValue * probability;
#else
return RandomNumberGenerator.GetInt32(int.MaxValue) < int.MaxValue * probability;
Expand Down
Loading