Skip to content

Commit

Permalink
Fix CS0436 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Taillefer committed Aug 11, 2023
1 parent 5bb4869 commit 64e6ca9
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 17 deletions.
10 changes: 0 additions & 10 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
<!-- This is false for local development, but set to true in the CI system -->
<TreatWarningsAsErrors Condition=" '$(TreatWarningsAsErrors)' == '' ">false</TreatWarningsAsErrors>

<!--
TODO: to be resolved (https://github.com/dotnet/extensions/issues/4128)
warning CS0436: (NETCORE_ENGINEERING_TELEMETRY=Build) The type '__Attributes' in
'Microsoft.Extensions.Options.SourceGeneration/Microsoft.Extensions.Options.Generators.Generator/Validators.g.cs' conflicts with the imported type
'__Attributes' in 'Microsoft.Extensions.Telemetry, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Using the type defined in 'Microsoft.Extensions.Options.SourceGeneration/Microsoft.Extensions.Options.Generators.Generator/Validators.g.cs'.
-->
<NoWarn>$(NoWarn);CS0436</NoWarn>

<!-- TODO: to be re-enabled and all warnings fixed (https://github.com/dotnet/extensions/issues/4002) -->
<NoWarn>$(NoWarn);IL2026;IL2087;IL2067;IL2075;IL2091;IL2072;IL2090;CA1825;IL2070;IL2098;IL2057</NoWarn>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<Description>Benchmarks for Microsoft.Extensions.Telemetry.</Description>
<UseLoggingGenerator>true</UseLoggingGenerator>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<InjectSharedPools>true</InjectSharedPools>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/MSBuild/Shared.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<ItemGroup>
<ItemGroup Condition="'$(InjectSharedDiagnosticIds)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\Shared\DiagnosticIds\*.cs" LinkBase="Shared\DiagnosticIds" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<PropertyGroup>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedPools>true</InjectSharedPools>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<InjectSkipLocalsInitAttributeOnLegacy>true</InjectSkipLocalsInitAttributeOnLegacy>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<InjectSharedRentedSpan>true</InjectSharedRentedSpan>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<PropertyGroup>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<PropertyGroup>
<InjectStringHashOnLegacy>true</InjectStringHashOnLegacy>
<InjectSharedNumericExtensions>true</InjectSharedNumericExtensions>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
<UseEnumStringsGenerator>true</UseEnumStringsGenerator>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<UseMeteringGenerator>true</UseMeteringGenerator>
<UseEnumStringsGenerator>true</UseEnumStringsGenerator>
<InjectSharedPools>true</InjectSharedPools>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<InjectSharedRentedSpan>true</InjectSharedRentedSpan>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedBufferWriterPool>true</InjectSharedBufferWriterPool>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PropertyGroup>
<UseLoggingGenerator>true</UseLoggingGenerator>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<InjectTrimAttributesOnLegacy>true</InjectTrimAttributesOnLegacy>
<InjectSharedDataValidation>true</InjectSharedDataValidation>
<InjectSharedPools>true</InjectSharedPools>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<PropertyGroup>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<InjectTrimAttributesOnLegacy>true</InjectTrimAttributesOnLegacy>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDataValidation>true</InjectSharedDataValidation>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<PropertyGroup>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
<InjectSharedPools>true</InjectSharedPools>
<DisableSourceGeneratorPropertyName>DisableMicrosoftExtensionsTelemetrySourceGeneration</DisableSourceGeneratorPropertyName>
<BuildAnalyzerReferences>true</BuildAnalyzerReferences>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PropertyGroup>
<InjectIsExternalInitOnLegacy>true</InjectIsExternalInitOnLegacy>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<InjectSharedPools>true</InjectSharedPools>
<InjectSharedRentedSpan>true</InjectSharedRentedSpan>
<InjectSharedMemoization>true</InjectSharedMemoization>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
<InjectGetOrAddOnLegacy>true</InjectGetOrAddOnLegacy>
<UseLoggingGenerator>true</UseLoggingGenerator>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PropertyGroup>
<InjectSharedEmptyCollections>true</InjectSharedEmptyCollections>
<InjectSharedDataValidation>true</InjectSharedDataValidation>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
</PropertyGroup>

Expand Down
11 changes: 11 additions & 0 deletions src/Shared/DiagnosticIds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Buffer Writer Pool

Gives access to diagnostics ids for the [Experimental] attribute.

To use this in your project, add the following to your `.csproj` file:

```xml
<PropertyGroup>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
</PropertyGroup>
```
5 changes: 0 additions & 5 deletions src/Shared/Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,4 @@
<InternalsVisibleToTest Include="$(AssemblyName).Tests" />
<InternalsVisibleToDynamicProxyGenAssembly2 Include="*" />
</ItemGroup>

<!-- WarningDefinitions.cs is included globally via eng\MSBuild\Shared.props -->
<ItemGroup>
<Compile Remove="DiagnosticIds\Experiments.cs" />
</ItemGroup>
</Project>

0 comments on commit 64e6ca9

Please sign in to comment.