-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to net9.0 #11000
Update to net9.0 #11000
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glad to see this go. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this source package would need more warnings to be suppressed with net9 (I'm not yet sure why, but some existing IDE* error codes started newly being reported with net9.0). It seems better to just include the one source file from this source package directly and make it conform to our editorconfig. I also fixed up some missing file headers that got missed because of the IDE0073 being ignored previously. |
||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(_MicrosoftExtensionsPackageVersion)" /> | ||
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="$(MicrosoftExtensionsObjectPoolPackageVersion)" /> | ||
<PackageVersion Include="Microsoft.Internal.VisualStudio.Shell.Framework" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
using Microsoft.AspNetCore.Mvc.Razor.Extensions; | ||
using Microsoft.AspNetCore.Razor.Test.Common; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CSharp; | ||
using Microsoft.CodeAnalysis.Test.Utilities; | ||
using Roslyn.Test.Utilities; | ||
|
||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests; | ||
|
@@ -22,8 +24,15 @@ public CodeGenerationIntegrationTest(bool designTime = false) | |
: base(layer: TestProject.Layer.Compiler) | ||
{ | ||
this.designTime = designTime; | ||
BaseCompilation = BaseCompilation.AddReferences( | ||
MetadataReference.CreateFromFile(typeof(TestTagHelperDescriptors).Assembly.Location)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assembly reference started failing due to now being net9.0 but others (via Basic.Reference.Assemblies) being net8.0. Refactoring of the following file (TestTagHelperDescriptors.cs) is related to this. |
||
var testTagHelpers = CSharpCompilation.Create( | ||
assemblyName: "Microsoft.AspNetCore.Razor.Language.Test", | ||
syntaxTrees: | ||
[ | ||
CSharpSyntaxTree.ParseText(TestTagHelperDescriptors.Code), | ||
], | ||
references: ReferenceUtil.AspNetLatestAll, | ||
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); | ||
BaseCompilation = BaseCompilation.AddReferences(testTagHelpers.VerifyDiagnostics().EmitToImageReference()); | ||
} | ||
|
||
[IntegrationTestFact] | ||
|
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(); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I guess it's not that simple, parts that deploy to VS/VSCode need to stay on net8.0. I will at least extract the independent parts of this PR for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make it more of a gradual change, you could add net9 to the multi-targeting, and we can continue to change it as the needs of SDK/VS/VSCode change. There are some tradeoffs to making the multi-targeting conditional to being on a CI machine or not.