Activate Expected Warnings
MODIFY
src/Chapter01/Chapter01.csproj
src/Chapter01/Chapter01.csproj
<!-- CA1052: Suggest Program is static which hasn't been explained yet. -->
<!-- IDE0059: Unnecessary assignment of a value ignored since listing is not complete. -->
<!-- IDE0060: Remove unused parameter suggestion ignored since listing is not complete -->
- <ExpectedWarnings>$(ExpectedWarnings),CS8600,CS8602,CA1052,IDE0059,IDE0060</ExpectedWarnings>
+ <!-- CS8600: Trust that null assignment doesn't cause
+ unexpected exception as concept to check for null hasn't been explained yet-->
+ <ExpectedWarnings>$(ExpectedWarnings),CS8600,CA1052,IDE0059,IDE0060</ExpectedWarnings>
+ <IgnoreExpectedWarnings>true</IgnoreExpectedWarnings>
</PropertyGroup>
<Import Project="..\Chapter.props" />
<ItemGroup>

MODIFY
src/Chapter02/Chapter02.csproj
src/Chapter02/Chapter02.csproj
<!-- CA1052: Suggest Program is static which hasn't been explained yet. -->
<!-- IDE0059: Unnecessary assignment of a value ignored since listing is not complete. -->
<!-- IDE0054: Use compound assignment because '+=" is not yet explained-->
+ <!-- CS8600, CS8602, CS8604: Trust that null assignment doesn't cause
+ unexpected exception as concept to check for null hasn't been explained yet-->
<ExpectedWarnings>$(ExpectedWarnings),CS8600,CS8602,CS8604,CA1052,IDE0059,IDE0054</ExpectedWarnings>
+ <IgnoreExpectedWarnings>true</IgnoreExpectedWarnings>
</PropertyGroup>
<Import Project="..\Chapter.props" />
<ItemGroup>

MODIFY
src/Chapter03/Chapter03.csproj
src/Chapter03/Chapter03.csproj
<!-- IDE0059: Unnecessary assignment of a value ignored since listing is not complete. -->
<!-- CA1822: Member does not access instance data and can be marked as static but the concept hasn't been defined yet. -->
<!-- IDE0042: Variable declaration can be deconstructed but the concept is not covered yet. -->
- <ExpectedWarnings>$(ExpectedWarnings),CA1052,IDE0059,CA1822,IDE0042</ExpectedWarnings>
+ <!-- CS8600, CS8602, CS8604: Trust that null assignment doesn't cause
+ unexpected exception as concept to check for null hasn't been explained yet-->
+ <ExpectedWarnings>$(ExpectedWarnings),CS8600,CS8602,CS8604,CA1052,IDE0059,CA1822,IDE0042</ExpectedWarnings>
+ <IgnoreExpectedWarnings>true</IgnoreExpectedWarnings>
</PropertyGroup>
<Import Project="..\Chapter.props" />
<ItemGroup>

MODIFY
src/Shared/NetCore.cs
src/Shared/NetCore.cs
@@ -6,7 +6,7 @@ public static class NetCore
public static string GetNetCoreVersion()
{
Assembly assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly;
- string[] assemblyPath = assembly.CodeBase!.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] assemblyPath = assembly.Location!.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App");
if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2)
return assemblyPath[netCoreAppIndex + 1];

Activate Expected Warnings