Skip to content

Remove pragma statements on obsolete warns #872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 16, 2020
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
2 changes: 2 additions & 0 deletions CodeGen/CodeGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<!-- Allow compile with various nullability warnings until fixed. -->
<WarningsNotAsErrors>8600,8601,8603,8604,8618,8619,8625</WarningsNotAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 0 additions & 4 deletions CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,8 @@ public void Ctor_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
var unitNames = units.Select(x => x.ToString());

// Obsolete members
#pragma warning disable 618
Assert.Equal(units, quantityInfo.Units);
Assert.Equal(unitNames, quantityInfo.UnitNames);
#pragma warning restore 618
}}

[Fact]
Expand Down Expand Up @@ -515,7 +513,6 @@ public void ToString_SFormatAndCulture_FormatsNumberWithGivenDigitsAfterRadixFor
Assert.Equal(""0.1235 {_baseUnitEnglishAbbreviation}"", new {_quantity.Name}(0.123456{_numberSuffix}, {_baseUnitFullName}).ToString(""s4"", culture));
}}

#pragma warning disable 612, 618

[Fact]
public void ToString_NullFormat_ThrowsArgumentNullException()
Expand All @@ -538,7 +535,6 @@ public void ToString_NullProvider_EqualsCurrentUICulture()
Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, ""g""), quantity.ToString(null, ""g""));
}}

#pragma warning restore 612, 618

[Fact]
public void Convert_ToBool_ThrowsInvalidCastException()
Expand Down
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@
<Target Name="VSTestIfTestProject">
<CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" />
</Target>

<!-- Warnings and errors -->
<PropertyGroup>
<!-- Warning instead of compile error on obsolete errors.-->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>612,618</WarningsNotAsErrors>
</PropertyGroup>
</Project>
1 change: 0 additions & 1 deletion UnitsNet.Benchmark/UnitsNet.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<Product>UnitsNet.Benchmark</Product>
<LangVersion>latest</LangVersion>
<RootNamespace>UnitsNet</RootNamespace>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<RootNamespace>UnitsNet.NumberExtensions.Tests</RootNamespace>
<LangVersion>latest</LangVersion>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

Expand Down
1 change: 0 additions & 1 deletion UnitsNet.NumberExtensions/UnitsNet.NumberExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<Nullable>enable</Nullable>
<RootNamespace>UnitsNet</RootNamespace>
<TargetFrameworks>netstandard2.0;net40</TargetFrameworks>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<RootNamespace>UnitsNet.Serialization.JsonNet.CompatibilityTests</RootNamespace>
<LangVersion>latest</LangVersion>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<RootNamespace>UnitsNet.Serialization.JsonNet.Tests</RootNamespace>
<LangVersion>latest</LangVersion>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<LangVersion>latest</LangVersion>
<RootNamespace>UnitsNet.Serialization.JsonNet</RootNamespace>
<TargetFrameworks>netstandard2.0;net40</TargetFrameworks>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
</PropertyGroup>

<!-- SourceLink -->
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading