-
Notifications
You must be signed in to change notification settings - Fork 245
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
add net8.0 target #3080
base: main
Are you sure you want to change the base?
add net8.0 target #3080
Conversation
- add net8.0 target to projects - fix all compiler warnings introduced by the new targets - removed unneeded dependencies since they are part of the .NET runtime fixes microsoft#3033
I assume the test failures are unrelated. |
@@ -184,6 +184,7 @@ dotnet_diagnostic.CA1305.severity = error | |||
dotnet_diagnostic.CA1307.severity = none | |||
dotnet_diagnostic.CA1308.severity = none | |||
dotnet_diagnostic.CA1508.severity = none | |||
dotnet_diagnostic.CA1510.severity = none |
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.
Disabled CA1510 because the throw helpers are not available on netstandard2.0 and #if
ing this is not worth it.
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> |
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.
This is part of the SDK since .NET 5, so unnecessary.
see https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview?tabs=net-9
Starting in .NET 5, these analyzers are included with the .NET SDK and you don't need to install them separately.
@@ -63,7 +63,7 @@ public void ApplyToTest(Test test) | |||
{ | |||
if (_combinations.Any(combination => | |||
{ | |||
var requirements = (Enum.GetValues(typeof(Targets)) as Targets[]).Where(x => combination.HasFlag(x)); | |||
var requirements = ((Targets[])Enum.GetValues(typeof(Targets))).Where(x => combination.HasFlag(x)); |
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 avoid null reference warning.
@@ -204,7 +208,7 @@ public async Task SetInputFilesAsync(IEnumerable<string> files, ElementHandleSet | |||
{ | |||
throw new PlaywrightException("Cannot set input files to detached element."); | |||
} | |||
var converted = await SetInputFilesHelpers.ConvertInputFilesAsync(files, (BrowserContext)frame.Page.Context).ConfigureAwait(false); | |||
var converted = await SetInputFilesHelpers.ConvertInputFilesAsync(files.ToList(), (BrowserContext)frame.Page.Context).ConfigureAwait(false); |
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.
This API was changed to accept a List because of CA1851.
Frame for this navigation request is not available, because the request | ||
was issued before the frame is created. You can check whether the request | ||
is a navigation request by calling isNavigationRequest() method. | ||
"""); |
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 fix CA1861.
@@ -314,105 +314,78 @@ internal void Dispatch(PlaywrightServerMessage message) | |||
|
|||
private ChannelOwner CreateRemoteObject(string parentGuid, ChannelOwnerType type, string guid, JsonElement? initializer) | |||
{ | |||
ChannelOwner result = null; |
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.
Refactored this to avoid CA2000.
@@ -399,16 +399,25 @@ internal class VisitorInfo | |||
internal VisitorInfo() | |||
{ | |||
Visited = new Dictionary<long, int>(); | |||
IDGenerator = new ObjectIDGenerator(); |
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.
ObjectIDGenerator
is obsolete since it's part of the BinaryFormatter API. Replaced this with a simple implementation based on dotnet/runtime#98168 (comment) .
@@ -186,7 +191,7 @@ private static void StartProcessWithUTF8IOEncoding(Process process) | |||
} | |||
} | |||
|
|||
private static Task ScheduleTransportTaskAsync(Func<CancellationToken, Task> func, CancellationToken cancellationToken) | |||
private static Task<Task> ScheduleTransportTaskAsync(Func<CancellationToken, Task> func, CancellationToken cancellationToken) |
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 fix CA1859.
@@ -345,7 +344,7 @@ private static object ParseEvaluateResultToExpando(JsonElement result, IDictiona | |||
|
|||
if (result.TryGetProperty("e", out var error)) | |||
{ | |||
return new Exception(error.GetProperty("s").ToString()); | |||
return new PlaywrightException(error.GetProperty("s").ToString()); |
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 fix CA2201. Not sure if this is OK to change?
await _process.StandardInput.BaseStream.WriteAsync(ll, 0, 4, _readerCancellationSource.Token).ConfigureAwait(false); | ||
await _process.StandardInput.BaseStream.WriteAsync(message, 0, len, _readerCancellationSource.Token).ConfigureAwait(false); | ||
#endif |
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 fix CA1835.
Some of these changes make sense regardless of the multi-targeting. Some of the
#if
s could obviously be avoided by ignoring the warning instead. I opted for#if
almost everywhere for now.fixes #3033