Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

[WIP] build-test - fix several thousands C# and NuGet warnings #19109

Closed
wants to merge 2 commits into from

Conversation

4creators
Copy link

Recent changes to test harness introduced several thousands new warnings from both C# code and NuGet references. This PR fixes most of them.

@4creators
Copy link
Author

cc @jashook @AaronRobinsonMSFT

pls cc anyone else who should be involved

@@ -29,6 +29,7 @@
<PrereleaseResolveNuGetPackages>false</PrereleaseResolveNuGetPackages>
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
<IsTestProject>false</IsTestProject>
<NoWarn>NU1603</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be resolved, instead, by updating to the actual version resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NU1603 is an upgrade warning

@@ -25,6 +25,7 @@
<RuntimeIdentifier Condition="'$(OSGroup)' == 'Linux'">linux-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(OSGroup)' == 'OSX'">osx-x64</RuntimeIdentifier>
<NugetRuntimeIdentifier>$(RuntimeIdentifier)</NugetRuntimeIdentifier>
<NoWarn>NU1603,NU1605</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NU1605 could also be resolved by updating to the actual version resolved (this is a downgrade warning).

@@ -55,7 +55,7 @@
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<!-- Disable some C# warnings for the tests. -->
<NoWarn>78,162,164,168,169,219,251,252,414,429,642,649,652,675,1691,1717,1718,3001,3002,3003,3005,3008</NoWarn>
<NoWarn>78,162,164,168,169,219,251,252,414,429,618,642,649,652,675,1685,1691,1717,1718,3001,3002,3003,3005,3008</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't hide CS0618, it is listing code being used that was marked Obsolete

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this for production code, but I think it is fine to disable it for tests.

We need to have tests for obsolete APIs. It is pretty annoying to disable the warning individually around every test that is testing obsolete API.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Testing code has different requirements with respect to code marked Obsolete. Regardless if it is marked that way or not users can use the API and as such it must be tested.

@@ -55,7 +55,7 @@
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<!-- Disable some C# warnings for the tests. -->
<NoWarn>78,162,164,168,169,219,251,252,414,429,642,649,652,675,1691,1717,1718,3001,3002,3003,3005,3008</NoWarn>
<NoWarn>78,162,164,168,169,219,251,252,414,429,618,642,649,652,675,1685,1691,1717,1718,3001,3002,3003,3005,3008</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS1685 sounds like RefAssemblies are misconfigured somewhere.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS1685 was left due to the https://github.com/dotnet/corefx/issues/31395. As long as benchmark.csproj and performance.csproj are built against incompatible frameworks (netstandard1.4 and netstandard1.6 with netcoreapp3.0 explicitly referenced assemblies) CS1685 will persist. Best solution would be to move this projects to netstandard2.0 which is according to tools compatible with netcoreapp3.0

@@ -255,7 +255,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
{
sErrorText = System.IO.File.ReadAllText(errorFile)%3B
}
catch(Exception ex)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include this in the message. This is a test and as such we need the exception details. It is easy to address:

sErrorText = $"Unable to read error file: {errorFIle}\n{ex}"%3B

Please also update the logic in the other location for the exception.

@@ -18,7 +18,7 @@
<Version>$(XunitPackageVersion)</Version>
</PackageReference>
<PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
<Version>1.0.0-prerelease-00629-04</Version>
<Version>1.0.0-prerelease-00704-04</Version>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package v1.0.0-prerelease-00629-04 is not available, updated to version resolved by NuGet

<SystemCompositionVersions>1.3.0-preview3-26501-04</SystemCompositionVersions>
<XUnitNetcoreExtensionsVersion>2.2.0-preview1-02902-01</XUnitNetcoreExtensionsVersion>
<SystemCompositionVersions>1.3.0-$(MicrosoftPrivateCoreFxNETCoreAppPackageVersion.Substring(6))</SystemCompositionVersions>
<XUnitNetcoreExtensionsVersion>2.2.0-preview1-03025-01</XUnitNetcoreExtensionsVersion>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composition packages version has been updated to always point to latest v1.3.0 available. Version 1.3.0-preview3-26501-04 has been always chosen over any 1.3.0-preview1-xxxxx-xx see https://github.com/dotnet/corefx/issues/31395

<PackageReference Include="System.Memory">
<Version>$(MicrosoftPrivateCoreFxNETCoreAppPackageVersion)</Version>
<NoWarn>NU1603</NoWarn>
<!-- Warnings NU1603 and NU1605 are raised due to the presence of v4.6.0-preview3-2650x-xx assemblies on myget-->
<!-- They prevent usage of newer 4.6.0-preview1 assemblies since NuGet treats preview3 as version always higher than preview1 -->
</PackageReference>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@4creators 4creators changed the title build-test - fix several thousands C# and NuGet warnings [WIP] build-test - fix several thousands C# and NuGet warnings Jul 28, 2018
@4creators
Copy link
Author

Closing as changes are handled by multiple PRs

@4creators 4creators closed this Aug 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants