Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f17f607
change library target frameworks to net6.0
benvillalobos Feb 10, 2021
b1ac2ab
CustomHttpRequestException obsolete in net6.0, use SupportedOSPlatform
benvillalobos Feb 17, 2021
c5ae661
Relax nullable warnings in stringtools
benvillalobos Feb 11, 2021
b2fa123
Update version of Microsoft.VisualStudio.Setup.Configuration.Interop
benvillalobos Feb 11, 2021
d98fe68
Use property to find netcoresdk bundledversions.props
benvillalobos Feb 18, 2021
3326faf
Use RuntimeIdentifierGraphPath var
benvillalobos Feb 18, 2021
642093a
Use #if RUNTIME_TYPE_NETCORE instead of NETSTANDARD for .NET Core-onl…
ladipro Mar 2, 2021
d5370bf
Fix path to ref assemblies
benvillalobos Jun 5, 2021
f6c1204
Update last SetTargetFramework to net6.0, use EscapeDataString instea…
benvillalobos Jun 5, 2021
6f0581f
Mark signfile as supported on windows
benvillalobos Jun 8, 2021
c720814
Revert "Fix path to ref assemblies"
benvillalobos Jun 8, 2021
499f6dc
Explicitly download netstandard.library for roslyncodetaskfactory
benvillalobos Jun 8, 2021
98b28d1
FindOnPathSucceeds: Ignore case on windows
benvillalobos Jun 10, 2021
a34b2fa
Fix SA1508 (blank line before curly brace)
benvillalobos Jan 13, 2022
36cff17
Revert FindOnPathSucceeds fix
benvillalobos Jan 13, 2022
982d5bc
Fix nullability warning CS8765
benvillalobos Jan 13, 2022
8e89508
Mark GetVersionIndependentToolPath as Windows only. Resolves CA1416 f…
benvillalobos Jan 18, 2022
ab5b02a
Fix SYSLIB0021 in BootstrapperBuilder
benvillalobos Jan 18, 2022
8cb9f2c
! Fix SYSLIB0021 in mansign2
benvillalobos Jan 18, 2022
18b8d7c
Fix CA2016 in DownloadFile
benvillalobos Jan 18, 2022
65212a4
Add PlatformGuard to NativeMethodsShared.IsWindows
benvillalobos Jan 18, 2022
e9bed31
NoWarn on CA1416
benvillalobos Jan 18, 2022
9863e76
Fix SYSLIB0021 in ManifestUtil/Util
benvillalobos Jan 18, 2022
c927db5
Target relevant projects to netstandard2.0. Prevent those targets fro…
benvillalobos Jan 25, 2022
27a0b10
PortableTask must build as ns2.0
benvillalobos Jan 26, 2022
42f8e51
Build M.B.Framework & Utilities as ns2.0 so RoslynCodeTaskFactory can…
benvillalobos Jan 26, 2022
28f0894
Merge branch 'main' into netstandard2.0-to-net5.0
benvillalobos Jan 27, 2022
7e07f74
System.Runtime.Versioning is used in netcore and full framework now
benvillalobos Jan 27, 2022
72bf1ac
Mimic AddRefAssemblies from MSBuild.csproj to M.B.Tasks.csproj
benvillalobos Jan 28, 2022
6a262ef
Remove CA1416 from NoWarn and mark each windows-specfic path as such.…
benvillalobos Jan 28, 2022
987fd62
Merge branch 'main' into netstandard2.0-to-net5.0
benvillalobos Jan 31, 2022
ce53557
Update latest package version
benvillalobos Feb 2, 2022
b388739
Merge branch 'main' into netstandard2.0-to-net5.0
benvillalobos Feb 3, 2022
44626b8
Last SignFile call is now under SupportedOSPlatform
benvillalobos Feb 4, 2022
6099f12
Code cleanup. Use RUNTIME_TYPE_NETCORE instead of NET5_0_OR_GREATER
benvillalobos Feb 4, 2022
5f3e506
Minor code cleanup
benvillalobos Feb 4, 2022
6a0fa83
Add FEATURE_FASTSPAN
benvillalobos Feb 4, 2022
c9362f3
Log an error if SignFile is called from a non-windows machine
benvillalobos Feb 4, 2022
aede573
Minor code cleanup
benvillalobos Feb 4, 2022
cf57afb
Add ns2.0 info to readme
benvillalobos Feb 7, 2022
63b0b39
PR Feedback: Code cleanup, mark classes with PlatformGuard, create Pl…
benvillalobos Feb 8, 2022
2a8ce53
Minor PR feedback
benvillalobos Feb 8, 2022
f253f5a
Create SupportedOSPlatform type for framework and ns2.0. Remove now-u…
benvillalobos Feb 9, 2022
ffb3d6b
Code cleanup. Use full paths for RuntimeIdentifierGraph and Microsoft…
benvillalobos Feb 9, 2022
a47d737
Libraries build as ns2.0 again. NuGet package contains ref assemblies…
benvillalobos Feb 10, 2022
ca7b487
ns2.0 targets dont publish pdbs
benvillalobos Feb 10, 2022
ecfff47
Remove unused target, redownload netstandard.library for tests
benvillalobos Feb 10, 2022
7b90a53
Always nowarn NU5131
benvillalobos Feb 10, 2022
0549c14
Prevent any version of GenerateManifest from running on a non-windows…
benvillalobos Feb 10, 2022
34a8b6d
Code cleanup
benvillalobos Feb 11, 2022
0bcaf19
Remove unneeded target. Fix whitespace in SignFile
benvillalobos Feb 11, 2022
2b00f97
Ship all ref assemblies in ref/ in NuGet package root
benvillalobos Feb 11, 2022
21a1975
Use TargetRefPath instead of IntermediateRefAssembly. Fix stale comment
benvillalobos Feb 11, 2022
f47d739
[PR Feedback] Fix slash on PackagePath
benvillalobos Mar 1, 2022
7e50fa8
[PR] Remove semicolon change for CS8632 to prevent a merge conflict
benvillalobos Mar 1, 2022
8771062
[PR] Check newer APIs using NET6_0_OR_GREATER. Updated Framework readme
benvillalobos Mar 1, 2022
4c7ff53
[PR] Use SupportedOSPlatform on GenerateDeploymentManifest and Genera…
benvillalobos Mar 1, 2022
990538c
Fix M.B.Utilities README
benvillalobos Mar 1, 2022
84a11ad
Simply throw in DownloadFile when catching an HttpRequestException
benvillalobos Mar 2, 2022
7ef24b2
SignFile and GenerateLauncher are marked as windows only.
benvillalobos Mar 2, 2022
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: 1 addition & 1 deletion eng/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Update="Microsoft.Build.NuGetSdkResolver" Version="$(NuGetBuildTasksVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.Build.Tasks" Version="$(MicrosoftNetCompilersToolsetVersion)" />
<PackageReference Update="Microsoft.CodeAnalysis.Collections" Version="4.0.0-4.21379.20" />
<PackageReference Update="Microsoft.CodeAnalysis.Collections" Version="4.2.0-1.22102.8" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have any exp/ insertions where you ran RPS? It'd also be nice if you could see why the optional test failed or find a known bug; lots of MSBuild-caused issues don't directly seem to mention MSBuild.

This change in particular sounds like it could cause version mismatches.

Copy link
Member Author

Choose a reason for hiding this comment

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

I could've sworn I ran RPS on https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/380160. I'll retrigger on that PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

The full suite of tests should be queued: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/380160

<PackageReference Update="Microsoft.DotNet.XUnitExtensions" Version="$(MicrosoftDotNetXUnitExtensionsVersion)" />
<PackageReference Update="Microsoft.IO.Redist" Version="6.0.0" />
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="$(MicrosoftNetCompilersToolsetVersion)" />
Expand Down
4 changes: 2 additions & 2 deletions src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
<ProjectReference Include="..\Samples\TaskWithDependency\TaskWithDependency.csproj" Private="false" ReferenceOutputAssembly="false" OutputItemType="TaskWithDependencyResolvedProjectReferencePath">
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">TargetFramework=$(FullFrameworkTFM)</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(MonoBuild)' == 'true'">TargetFramework=$(FullFrameworkTFM)</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">TargetFramework=netstandard2.0</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">TargetFramework=net6.0</SetTargetFramework>
</ProjectReference>
<ProjectReference Include="..\Samples\PortableTask\PortableTask.csproj" Private="false" ReferenceOutputAssembly="false" OutputItemType="PortableTaskResolvedProjectReferencePath" SetTargetFramework="TargetFramework=netstandard2.0" />
<ProjectReference Include="..\Samples\PortableTask\PortableTask.csproj" Private="false" ReferenceOutputAssembly="false" OutputItemType="PortableTaskResolvedProjectReferencePath" />

<ProjectReference Include="..\Samples\ProjectCachePlugin\ProjectCachePlugin.csproj" Private="false" ReferenceOutputAssembly="false">
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">TargetFramework=$(FullFrameworkTFM)</SetTargetFramework>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.BeforeCommon.targets
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

<PropertyGroup Condition="'$(MonoBuild)' != 'true' and ($([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETCoreApp' or $([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETStandard')">
<NetCoreBuild>true</NetCoreBuild>
<DefineConstants>$(DefineConstants);RUNTIME_TYPE_NETCORE</DefineConstants>
<DefineConstants>$(DefineConstants);RUNTIME_TYPE_NETCORE;FEATURE_FASTSPAN</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(NetCoreBuild)'=='true'">
Expand Down
38 changes: 36 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<!-- Ensure that compiler errors emit full paths so that files
can be correctly annotated in GitHub. -->
<GenerateFullPaths>true</GenerateFullPaths>

<!-- https://github.com/NuGet/Home/issues/8684 -->
<NoWarn>$(NoWarn);NU5131</NoWarn>

<!-- Do not mangle paths for test assemblies, because Shoudly assertions want actual on-disk paths. -->
<DeterministicSourcePaths Condition="'$(IsTestProject)' == 'true'">false</DeterministicSourcePaths>
Expand All @@ -27,8 +30,9 @@
<Platforms>AnyCPU;x64</Platforms>

<!-- Defaults for target frameworks and architecture -->
<LibraryTargetFrameworks>$(FullFrameworkTFM);netstandard2.0</LibraryTargetFrameworks>
<LibraryTargetFrameworks Condition="'$(MonoBuild)'=='true'">$(FullFrameworkTFM)</LibraryTargetFrameworks>
<LibraryTargetFrameworks>$(FullFrameworkTFM);net6.0;netstandard2.0</LibraryTargetFrameworks>
<LibraryTargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true'">net6.0;netstandard2.0</LibraryTargetFrameworks>
<LibraryTargetFrameworks Condition="'$(MonoBuild)'=='true'">$(FullFrameworkTFM);netstandard2.0</LibraryTargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still care about this?

Copy link
Member Author

Choose a reason for hiding this comment

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

About the monobuild case adding ns2.0? I added it to be safe because of how we're shipping ns2.0 ref assemblies now.

<PlatformTarget>AnyCPU</PlatformTarget>

<!-- Target frameworks for Exe and unit test projects (ie projects with runtime output) -->
Expand Down Expand Up @@ -71,4 +75,34 @@
<!-- When targeting .NET Core, Exe and unit tests projects always use AnyCPU architecture -->
<RuntimeOutputPlatformTarget>AnyCPU</RuntimeOutputPlatformTarget>
</PropertyGroup>

<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificContentInPackage);ShipRefAssembliesToNuGetPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>

<!-- Produce ONLY reference assemblies and SKIP roslyn analyzers for netstandard2.0 builds. -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' and '$(MSBuildProjectFile)' != 'PortableTask.csproj'">
<!-- ProduceOnlyReferenceAssembly and ProduceReferenceAssembly are mutually exclusive compiler flags. -->
<ProduceOnlyReferenceAssembly>true</ProduceOnlyReferenceAssembly>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<RunAnalyzers>false</RunAnalyzers>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificContentInPackage);ShipRefAssembliesToNuGetPackage</TargetsForTfmSpecificBuildOutput>
<IncludeBuildOutput>false</IncludeBuildOutput>
<!-- pdb publishing fails builds for reference-only assemblies. -->
<!-- https://github.com/dotnet/msbuild/pull/6148. -->
<PublishWindowsPdb>false</PublishWindowsPdb>
</PropertyGroup>

<!-- Ensure ref assemblies are placed under `ref/$(TargetFramework)` in the NuGet package -->
<Target Name="ShipRefAssembliesToNuGetPackage" BeforeTargets="Pack" Condition="$(IsInnerBuild) == true">
Copy link
Contributor

Choose a reason for hiding this comment

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

How is TfmSpecificPackageFile consumed?

Copy link
Member Author

Choose a reason for hiding this comment

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

<ItemGroup>
<TfmSpecificPackageFile Include="$(TargetRefPath);@(FinalDocFile)">
<PackagePath>ref\$(TargetFramework)</PackagePath>
</TfmSpecificPackageFile>
<!-- ns2.0 builds use `BuiltProjectOutputGroupOutput` for output ref assemblies -->
<TfmSpecificPackageFile Include="@(BuiltProjectOutputGroupOutput)" Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackagePath>ref\$(TargetFramework)</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>
</Project>
36 changes: 19 additions & 17 deletions src/Framework/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;

Expand All @@ -21,9 +22,10 @@
#nullable disable

namespace Microsoft.Build.Framework;

internal static class NativeMethods
{
#region Constants
#region Constants

internal const uint ERROR_INSUFFICIENT_BUFFER = 0x8007007A;
internal const uint STARTUP_LOADER_SAFEMODE = 0x10;
Expand Down Expand Up @@ -71,9 +73,9 @@ internal static class NativeMethods
internal const uint WAIT_OBJECT_0 = 0x00000000;
internal const uint WAIT_TIMEOUT = 0x00000102;

#endregion
#endregion

#region Enums
#region Enums

private enum PROCESSINFOCLASS : int
{
Expand Down Expand Up @@ -198,9 +200,9 @@ internal enum ProcessorArchitectures
Unknown
}

#endregion
#endregion

#region Structs
#region Structs

/// <summary>
/// Structure that contain information about the system on which we are running
Expand Down Expand Up @@ -568,9 +570,9 @@ private unsafe static int GetLogicalCoreCountOnWindows()
return -1;
}

#endregion
#endregion

#region Member data
#region Member data

internal static bool HasMaxPath => MaxPath == MAX_PATH;

Expand Down Expand Up @@ -709,10 +711,10 @@ internal static bool IsMono
#if !CLR2COMPATIBILITY
private static bool? _isWindows;
#endif

/// <summary>
/// Gets a flag indicating if we are running under some version of Windows
/// </summary>
[SupportedOSPlatformGuard("windows")]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you can do this? Doesn't this mean that platforms other than windows can't check if they're windows or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

No it's still allowed, it prevents the compiler from complaining about windows only code paths. Basically, IsWindows itself is treated as a [SupportedOSPlatform("windows")]

internal static bool IsWindows
{
#if CLR2COMPATIBILITY
Expand Down Expand Up @@ -867,9 +869,9 @@ private static SystemInformationData SystemInformation
/// </summary>
internal static ProcessorArchitectures ProcessorArchitectureNative => SystemInformation.ProcessorArchitectureTypeNative;

#endregion
#endregion

#region Wrapper methods
#region Wrapper methods

/// <summary>
/// Really truly non pumping wait.
Expand Down Expand Up @@ -1451,9 +1453,9 @@ internal static void VerifyThrowWin32Result(int result)
}
}

#endregion
#endregion

#region PInvoke
#region PInvoke

/// <summary>
/// Gets the current OEM code page which is used by console apps
Expand Down Expand Up @@ -1609,9 +1611,9 @@ out FILETIME lpLastWriteTime
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern bool SetThreadErrorMode(int newMode, out int oldMode);

#endregion
#endregion

#region Extensions
#region Extensions

/// <summary>
/// Waits while pumping APC messages. This is important if the waiting thread is an STA thread which is potentially
Expand Down Expand Up @@ -1654,9 +1656,9 @@ internal static bool MsgWaitOne(this WaitHandle handle, int timeout)
return returnValue == 0;
}

#endregion
#endregion

#region helper methods
#region helper methods

internal static bool DirectoryExists(string fullPath)
{
Expand Down Expand Up @@ -1699,6 +1701,6 @@ internal static bool FileOrDirectoryExistsWindows(string path)
return GetFileAttributesEx(path, 0, ref data);
}

#endregion
#endregion

}
5 changes: 5 additions & 0 deletions src/Framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ This package contains `Microsoft.Build.Framework.dll`, which defines [fundamenta

The items in this namespace are primarily base-level classes and interfaces shared across MSBuild's object model. MSBuild task or extension developers can reference this package to implement interfaces such as
[`ITask`](https://docs.microsoft.com/dotnet/api/microsoft.build.framework.itask), and [`ILogger`](https://docs.microsoft.com/dotnet/api/microsoft.build.framework.ilogger).

### netstandard2.0 target
The `netstandard2.0` target of this build is configured only to output reference assemblies; at runtime MSBuild will be `net6.0` or `net472`. Please use the `net6.0`-targeted assemblies for .NET Core 6+ scenarios.

For context, see https://github.com/dotnet/msbuild/pull/6148
2 changes: 1 addition & 1 deletion src/Framework/Sdk/SdkResultItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public SdkResultItem(string itemSpec, Dictionary<string, string>? metadata)
Metadata = metadata;
}

public override bool Equals(object obj)
public override bool Equals(object? obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just because you touched it...

Should the equality check not be case insensitive?

Copy link
Contributor

Choose a reason for hiding this comment

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

Bump

Copy link
Member Author

Choose a reason for hiding this comment

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

Created an issue for this: #7427

{
if (obj is SdkResultItem item &&
ItemSpec == item.ItemSpec &&
Expand Down
27 changes: 27 additions & 0 deletions src/Framework/SupportedOSPlatform.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if !NET6_0_OR_GREATER
namespace System.Runtime.Versioning
{
/// <summary>
/// SupportedOSPlatform is a net5.0+ Attribute.
/// Create the same type only in full-framework and netstandard2.0 builds
/// to prevent many #if RUNTIME_TYPE_NETCORE checks.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
internal class SupportedOSPlatformGuard : Attribute
{
internal SupportedOSPlatformGuard(string platformName)
{
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Class)]
internal class SupportedOSPlatform : Attribute
{
internal SupportedOSPlatform(string platformName)
{
}
}
}
#endif
7 changes: 7 additions & 0 deletions src/MSBuild/MSBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@
<PackageReference Include="Microsoft.IO.Redist" Condition="'$(FeatureMSIORedist)' == 'true'" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
</ItemGroup>
<!-- Manually download this library for RoslynCodeTaskFactory.
See target AddRefAssemblies below. -->
<ItemGroup>
<PackageDownload Include="netstandard.library">
<Version>[2.0.3]</Version>
</PackageDownload>
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<!-- File for Assemblies we depend on -->
<Reference Include="System" />
Expand Down
3 changes: 3 additions & 0 deletions src/MSBuildTaskHost/MSBuildTaskHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
<Compile Include="..\Framework\StringBuilderCache.cs">
<Link>StringBuilderCache.cs</Link>
</Compile>
<Compile Include="..\Framework\SupportedOSPlatform.cs">
<Link>SupportedOSPlatform.cs</Link>
</Compile>
<Compile Include="..\Shared\TaskEngineAssemblyResolver.cs">
<Link>TaskEngineAssemblyResolver.cs</Link>
</Compile>
Expand Down
2 changes: 1 addition & 1 deletion src/Samples/PortableTask/PortableTask.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<UseProductOutputPath>true</UseProductOutputPath>
<CopyNuGetImplementations>false</CopyNuGetImplementations>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Include="portableTaskTest.proj">
Expand Down
10 changes: 5 additions & 5 deletions src/StringTools/InternableString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public bool MoveNext()
/// </summary>
private readonly ReadOnlySpan<char> _inlineSpan;

#if NETSTANDARD
#if FEATURE_FASTSPAN
/// <summary>
/// .NET Core does not keep a reference to the containing object in <see cref="ReadOnlySpan{T}"/>. In particular,
/// it cannot recover the string if the span represents one. We have to hold the reference separately to be able to
Expand All @@ -122,7 +122,7 @@ internal InternableString(ReadOnlySpan<char> span)
_inlineSpan = span;
_spans = null;
Length = span.Length;
#if NETSTANDARD
#if FEATURE_FASTSPAN
_inlineSpanString = null;
#endif
}
Expand All @@ -141,7 +141,7 @@ internal InternableString(string str)
_inlineSpan = str.AsSpan();
_spans = null;
Length = str.Length;
#if NETSTANDARD
#if FEATURE_FASTSPAN
_inlineSpanString = str;
#endif
}
Expand All @@ -154,7 +154,7 @@ internal InternableString(SpanBasedStringBuilder stringBuilder)
_inlineSpan = default(ReadOnlySpan<char>);
_spans = stringBuilder.Spans;
Length = stringBuilder.Length;
#if NETSTANDARD
#if FEATURE_FASTSPAN
_inlineSpanString = null;
#endif
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public unsafe string ExpensiveConvertToString()
// Special case: if we hold just one string, we can directly return it.
if (_inlineSpan.Length == Length)
{
#if NETSTANDARD
#if FEATURE_FASTSPAN
if (_inlineSpanString != null)
{
return _inlineSpanString;
Expand Down
4 changes: 2 additions & 2 deletions src/StringTools/WeakStringCache.Concurrent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public string GetOrCreateEntry(ref InternableString internable, out bool cacheHi
{
int hashCode = internable.GetHashCode();

StringWeakHandle handle;
StringWeakHandle? handle;
string? result;

// Get the existing handle from the cache and lock it while we're dereferencing it to prevent a race with the Scavenge
Expand Down Expand Up @@ -98,7 +98,7 @@ public void Scavenge()
foreach (KeyValuePair<int, StringWeakHandle> entry in _stringsByHashCode)
{
// We can safely dereference entry.Value as the caller guarantees that Scavenge runs only on one thread.
if (!entry.Value.IsUsed && _stringsByHashCode.TryRemove(entry.Key, out StringWeakHandle removedHandle))
if (!entry.Value.IsUsed && _stringsByHashCode.TryRemove(entry.Key, out StringWeakHandle? removedHandle))
{
lock (removedHandle)
{
Expand Down
1 change: 0 additions & 1 deletion src/Tasks.UnitTests/AssemblyDependency/Miscellaneous.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using SystemProcessorArchitecture = System.Reflection.ProcessorArchitecture;
using Xunit.Abstractions;
using Shouldly;
using System.Text;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


#nullable disable

Expand Down
2 changes: 1 addition & 1 deletion src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<ProjectReference Include="..\Tasks\Microsoft.Build.Tasks.csproj" />
<ProjectReference Include="..\Utilities\Microsoft.Build.Utilities.csproj" />
<ProjectReference Include="..\Xunit.NetCore.Extensions\Xunit.NetCore.Extensions.csproj" />
<ProjectReference Include="..\Samples\PortableTask\PortableTask.csproj" ReferenceOutputAssembly="false" Private="false" SetTargetFramework="TargetFramework=netstandard2.0" />
<ProjectReference Include="..\Samples\PortableTask\PortableTask.csproj" ReferenceOutputAssembly="false" Private="false" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Expand Down
Loading