Skip to content

Commit 8c42543

Browse files
authored
Remove source-only package (#11006)
1 parent faba442 commit 8c42543

File tree

7 files changed

+54
-11
lines changed

7 files changed

+54
-11
lines changed

Directory.Packages.props

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="$(_MicrosoftExtensionsPackageVersion)" />
6464
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(_MicrosoftExtensionsPackageVersion)" />
6565
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(_MicrosoftExtensionsPackageVersion)" />
66-
<PackageVersion Include="Microsoft.Extensions.NonCapturingTimer.Sources" Version="5.0.0-preview.4.20205.1" />
6766
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(_MicrosoftExtensionsPackageVersion)" />
6867
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="$(MicrosoftExtensionsObjectPoolPackageVersion)" />
6968
<PackageVersion Include="Microsoft.Internal.VisualStudio.Shell.Framework" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" />

NuGet.config

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
</packageSource>
6868
<packageSource key="dotnet6-transport">
6969
<package pattern="microsoft.net.sdk.razor" />
70-
<package pattern="microsoft.extensions.noncapturingtimer.sources" />
7170
</packageSource>
7271
<packageSource key="dotnet8">
7372
<package pattern="microsoft.*" />

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/IRazorGeneratedDocumentExtensions.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System;
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the MIT license. See License.txt in the project root for license information.
3+
4+
using System;
25
using Microsoft.CodeAnalysis.Text;
36

47
namespace Microsoft.AspNetCore.Razor.Language;

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj

-6
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,12 @@
77
<IsShippingPackage>false</IsShippingPackage>
88
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
99
<IsPackable Condition="'$(OS)' != 'Windows_NT'">false</IsPackable>
10-
<!--
11-
The NonCapturingTimer package is a source package, and the source files in there don't conform to our header
12-
poilcy, so we have to ignore that error code for this project.
13-
-->
14-
<NoWarn>$(NoWarn);IDE0073</NoWarn>
1510
</PropertyGroup>
1611

1712
<ItemGroup>
1813
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
1914
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.Razor" />
2015
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" />
21-
<PackageReference Include="Microsoft.Extensions.NonCapturingTimer.Sources" PrivateAssets="all" />
2216
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" />
2317
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" />
2418
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Internal" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the MIT license. See License.txt in the project root for license information.
3+
4+
// https://github.com/dotnet/runtime/blob/11c86d8acba2f248b3afb5e8594f5f41ceebf098/src/libraries/Common/src/Extensions/NonCapturingTimer/NonCapturingTimer.cs
5+
6+
using System;
7+
using System.Threading;
8+
9+
namespace Microsoft.Extensions.Internal;
10+
11+
// A convenience API for interacting with System.Threading.Timer in a way
12+
// that doesn't capture the ExecutionContext. We should be using this (or equivalent)
13+
// everywhere we use timers to avoid rooting any values stored in asynclocals.
14+
internal static class NonCapturingTimer
15+
{
16+
public static Timer Create(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
17+
{
18+
if (callback is null)
19+
{
20+
throw new ArgumentNullException(nameof(callback));
21+
}
22+
23+
// Don't capture the current ExecutionContext and its AsyncLocals onto the timer
24+
var restoreFlow = false;
25+
try
26+
{
27+
if (!ExecutionContext.IsFlowSuppressed())
28+
{
29+
ExecutionContext.SuppressFlow();
30+
restoreFlow = true;
31+
}
32+
33+
return new Timer(callback, state, dueTime, period);
34+
}
35+
finally
36+
{
37+
// Restore the current ExecutionContext
38+
if (restoreFlow)
39+
{
40+
ExecutionContext.RestoreFlow();
41+
}
42+
}
43+
}
44+
}

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RemoteAutoInsertOptions.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System.Runtime.Serialization;
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the MIT license. See License.txt in the project root for license information.
3+
4+
using System.Runtime.Serialization;
25
using Microsoft.CodeAnalysis.Razor.Formatting;
36
using Microsoft.CodeAnalysis.Razor.Settings;
47

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TextDifferencing/TextDiffer.IntArray.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Licensed under the MIT license. See License.txt in the project root for license information.
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the MIT license. See License.txt in the project root for license information.
23

34
using System;
45
using System.Buffers;

0 commit comments

Comments
 (0)