Skip to content
Draft
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
6 changes: 6 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@
<PackageReference Include="SIL.ReleaseTasks" Version="2.5.0" PrivateAssets="All" Condition="'$(Configuration)' != 'Debug'" />
</ItemGroup>

<!-- "Sentry" uses "Polyfill" and gives access to it's internals via "InternalsVisibleTo", but some Polyfills are in a separate namespace -->
<ItemGroup Condition="'$(MSBuildProjectName)' != 'Sentry' And $(MSBuildProjectName.StartsWith('Sentry.'))">
<!-- the latest TargetFramework requires no Polyfills; "Sentry.Compiler.Extensions" has its own Polyfills -->
<Using Include="Polyfills" Condition="'$(TargetFramework)' != $(LatestTfm) And $(MSBuildProjectName) != 'Sentry.Compiler.Extensions'" />
</ItemGroup>

</Project>
12 changes: 11 additions & 1 deletion src/Sentry.Analyzers/Sentry.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@
https://github.com/SimonCropp/Polyfill
-->
<ItemGroup>
<PackageReference Include="Polyfill" Version="1.32.0" PrivateAssets="all" />
<PackageReference Include="Polyfill" Version="9.8.1" PrivateAssets="all" />
</ItemGroup>
<Target Name="BeforePreparePolyfill" BeforeTargets="PreparePolyfill">
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PolyfillNoWarnIncorrectVersion>true</PolyfillNoWarnIncorrectVersion>
</PropertyGroup>
</Target>
<Target Name="AfterPreparePolyfill" AfterTargets="PreparePolyfill" DependsOnTargets="PreparePolyfill">
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>$([System.String]::Copy('$(DefineConstants)').Replace('FeatureMemory','').Replace(';;',';'))</DefineConstants>
</PropertyGroup>
</Target>

<ItemGroup>
<Using Remove="System.Text.Json" />
Expand Down
8 changes: 2 additions & 6 deletions src/Sentry/Internal/Extensions/CollectionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,14 @@ public static IEnumerable<KeyValuePair<TKey, TValue>> WhereNotNullValue<TKey, TV
}
}
}

public static IEnumerable<KeyValuePair<TKey, TValue>> Append<TKey, TValue>(
this IEnumerable<KeyValuePair<TKey, TValue>> source, TKey key, TValue value) =>
source.Append(new KeyValuePair<TKey, TValue>(key, value));

public static IReadOnlyList<T> AsReadOnly<T>(this IList<T> list) =>
list as IReadOnlyList<T> ?? new ReadOnlyCollection<T>(list);

#if !NET7_0_OR_GREATER
public static IReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
where TKey : notnull =>
new ReadOnlyDictionary<TKey, TValue>(dictionary);
#endif

public static IEnumerable<T> ExceptNulls<T>(this IEnumerable<T?> source) =>
source.Where(x => x != null).Select(x => x!);

Expand Down
6 changes: 5 additions & 1 deletion src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@
https://github.com/SimonCropp/Polyfill
-->
<ItemGroup>
<PackageReference Include="Polyfill" Version="1.32.0" PrivateAssets="all" />
<PackageReference Include="Polyfill" Version="9.8.1" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup>
<DefineConstants Condition="'$(TargetFramework)' == 'netstandard2.0'">$(DefineConstants);FeatureHttp</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FeatureHttp</DefineConstants>
</PropertyGroup>

<!--
On .NET Framework, we need a package reference to System.Runtime.InteropServices.RuntimeInformation.
Expand Down
6 changes: 6 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,10 @@
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

<!-- "Sentry" uses "Polyfill" and gives access to it's internals via "InternalsVisibleTo", but some Polyfills are in a separate namespace -->
<ItemGroup Condition="'$(MSBuildProjectName)' != 'Sentry' And $(MSBuildProjectName.StartsWith('Sentry.'))">
<!-- the latest TargetFramework requires no Polyfills -->
<Using Include="Polyfills" Condition="'$(TargetFramework)' != $(LatestTfm)" />
</ItemGroup>

</Project>
Loading