Skip to content

Commit

Permalink
Remove source-only package (#11006)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz authored Oct 14, 2024
1 parent faba442 commit 8c42543
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 11 deletions.
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="$(_MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(_MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(_MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.NonCapturingTimer.Sources" Version="5.0.0-preview.4.20205.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(_MicrosoftExtensionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="$(MicrosoftExtensionsObjectPoolPackageVersion)" />
<PackageVersion Include="Microsoft.Internal.VisualStudio.Shell.Framework" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" />
Expand Down
1 change: 0 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
</packageSource>
<packageSource key="dotnet6-transport">
<package pattern="microsoft.net.sdk.razor" />
<package pattern="microsoft.extensions.noncapturingtimer.sources" />
</packageSource>
<packageSource key="dotnet8">
<package pattern="microsoft.*" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.

using System;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.AspNetCore.Razor.Language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@
<IsShippingPackage>false</IsShippingPackage>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<IsPackable Condition="'$(OS)' != 'Windows_NT'">false</IsPackable>
<!--
The NonCapturingTimer package is a source package, and the source files in there don't conform to our header
poilcy, so we have to ignore that error code for this project.
-->
<NoWarn>$(NoWarn);IDE0073</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.Razor" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" />
<PackageReference Include="Microsoft.Extensions.NonCapturingTimer.Sources" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Internal" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.

// https://github.com/dotnet/runtime/blob/11c86d8acba2f248b3afb5e8594f5f41ceebf098/src/libraries/Common/src/Extensions/NonCapturingTimer/NonCapturingTimer.cs

using System;
using System.Threading;

namespace Microsoft.Extensions.Internal;

// A convenience API for interacting with System.Threading.Timer in a way
// that doesn't capture the ExecutionContext. We should be using this (or equivalent)
// everywhere we use timers to avoid rooting any values stored in asynclocals.
internal static class NonCapturingTimer
{
public static Timer Create(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
{
if (callback is null)
{
throw new ArgumentNullException(nameof(callback));
}

// Don't capture the current ExecutionContext and its AsyncLocals onto the timer
var restoreFlow = false;
try
{
if (!ExecutionContext.IsFlowSuppressed())
{
ExecutionContext.SuppressFlow();
restoreFlow = true;
}

return new Timer(callback, state, dueTime, period);
}
finally
{
// Restore the current ExecutionContext
if (restoreFlow)
{
ExecutionContext.RestoreFlow();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Runtime.Serialization;
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.

using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.Razor.Formatting;
using Microsoft.CodeAnalysis.Razor.Settings;

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

using System;
using System.Buffers;
Expand Down

0 comments on commit 8c42543

Please sign in to comment.