Skip to content

Commit

Permalink
Merge pull request #963 from AArnott/libTemplateUpdate
Browse files Browse the repository at this point in the history
Merge latest Library.Template
  • Loading branch information
AArnott authored Sep 21, 2023
2 parents ad44c9f + 1feb491 commit 665201f
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"powershell": {
"version": "7.3.5",
"version": "7.3.6",
"commands": [
"pwsh"
]
Expand All @@ -15,7 +15,7 @@
]
},
"dotnet-coverage": {
"version": "17.7.3",
"version": "17.8.6",
"commands": [
"dotnet-coverage"
]
Expand Down
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ indent_size = 2
indent_size = 2
indent_style = space

[*.ps1]
indent_style = space
indent_size = 4

# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
Expand Down
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ updates:
schedule:
interval: weekly
ignore:
# This package has unlisted versions on nuget.org that are not supported. Avoid them.
- dependency-name: dotnet-format
versions: ["6.x", "7.x", "8.x"]
- dependency-name: Newtonsoft.Json # This has to match VS and VS rarely updates it
- dependency-name: Microsoft.AspNetCore.TestHost # Later versions require .NET Core 3.1, which prevents our testing on net472
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>

<MessagePackVersion>2.5.108</MessagePackVersion>
<MicroBuildVersion>2.0.130</MicroBuildVersion>
<VisualStudioThreadingVersion>17.6.40</VisualStudioThreadingVersion>
<MicroBuildVersion>2.0.146</MicroBuildVersion>
<VisualStudioThreadingVersion>17.7.35</VisualStudioThreadingVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.2" />
Expand All @@ -17,7 +17,7 @@
<PackageVersion Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="Microsoft.VisualStudio.Internal.MicroBuild.NonShipping" Version="$(MicroBuildVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="$(VisualStudioThreadingVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="$(VisualStudioThreadingVersion)" />
Expand All @@ -34,11 +34,11 @@
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="7.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="xunit.combinatorial" Version="1.5.25" />
<PackageVersion Include="xunit.runner.console" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="xunit.runner.console" Version="2.5.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.1" />
<PackageVersion Include="xunit.skippablefact" Version="1.4.13" />
<PackageVersion Include="xunit.stafact" Version="1.1.11" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit" Version="2.5.1" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.495" />
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- template: install-dependencies.yml

- script: dotnet tool run nbgv cloud -ca
- script: dotnet nbgv cloud -ca
displayName: ⚙ Set build number

- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}:
Expand Down
1 change: 1 addition & 0 deletions azure-pipelines/microbuild.before.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ steps:
outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE
outputformat: text
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
retryCountOnTaskFailure: 3 # fails when the cloud service is overloaded

- task: MicroBuildOptProfPlugin@6
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<!-- Include and reference README in nuge package, if a README is in the project directory. -->
<!-- Include and reference README in nuget package, if a README is in the project directory. -->
<PropertyGroup>
<PackageReadmeFile Condition="Exists('README.md')">README.md</PackageReadmeFile>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/StreamJsonRpc.Tests/AsyncEnumerableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public async Task GetIAsyncEnumerableAsReturnType_MinBatchSize(bool useProxy)
// Within a batch, the MoveNextAsync call should absolutely complete synchronously.
ValueTask<bool> valueTask = enumerator.MoveNextAsync();
Assert.True(valueTask.IsCompleted);
Assert.True(valueTask.GetAwaiter().GetResult());
Assert.True(await valueTask);
}

int number = enumerator.Current;
Expand Down
6 changes: 3 additions & 3 deletions test/StreamJsonRpc.Tests/DuplexPipeMarshalingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ await this.clientRpc.InvokeWithParameterObjectAsync(
public async Task ServerMethodThatReturnsStream()
{
using StreamReader result = new StreamReader(await this.clientRpc.InvokeAsync<Stream>(nameof(Server.ServerMethodThatReturnsStream)));
string returnedContent = await result.ReadToEndAsync().ConfigureAwait(false);
string returnedContent = await result.ReadToEndAsync();
Assert.Equal("Streamed bits!", returnedContent);
}

Expand All @@ -305,11 +305,11 @@ public async Task ClientCanWriteAndReadFromTwoWayStream()
var writeOnlyStream = new StreamWriter(remoteStream);

// Read server message
var serverReply = await readOnlyStream.ReadLineAsync().ConfigureAwait(false);
var serverReply = await readOnlyStream.ReadLineAsync();
Assert.Equal("Streamed bits!", serverReply);

// Verify server received client response
await writeOnlyStream.WriteLineAsync("Returned bytes").ConfigureAwait(false);
await writeOnlyStream.WriteLineAsync("Returned bytes");
await writeOnlyStream.FlushAsync().WithCancellation(this.TimeoutToken);

Assumes.NotNull(this.server.ChatLaterTask);
Expand Down
12 changes: 6 additions & 6 deletions test/StreamJsonRpc.Tests/JsonRpcRemoteTargetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public async Task InvokeRemoteTargetWithExistingId()

await Task.WhenAll(resultLocalTask, resultRemoteTask);

Assert.Equal(5, resultLocalTask.Result);
Assert.Equal(2, resultRemoteTask.Result);
Assert.Equal(5, await resultLocalTask);
Assert.Equal(2, await resultRemoteTask);
}

[Fact]
Expand Down Expand Up @@ -215,8 +215,8 @@ public async Task VerifyMethodsAreInvokedInOrderBeforeYielding()
await Task.WhenAll(relaySleepCallTask, remoteCallTask);

Assert.Equal(1, LocalOriginTarget.InvokeCount);
Assert.Equal(2, relaySleepCallTask.Result);
Assert.Equal(3, remoteCallTask.Result);
Assert.Equal(2, await relaySleepCallTask);
Assert.Equal(3, await remoteCallTask);
}

[Fact(Skip = "Unstable. See https://github.com/microsoft/vs-streamjsonrpc/issues/336")]
Expand All @@ -240,8 +240,8 @@ public async Task VerifyMethodOrderingIsNotGuaranteedAfterYielding()
await Task.WhenAll(relayDelayCallTask, remoteCallTask);

Assert.Equal(1, LocalOriginTarget.InvokeCount);
Assert.Equal(3, relayDelayCallTask.Result);
Assert.Equal(2, remoteCallTask.Result);
Assert.Equal(3, await relayDelayCallTask);
Assert.Equal(2, await remoteCallTask);
}

protected virtual IJsonRpcMessageHandler CreateHandler(Stream sending, Stream receiving) => new HeaderDelimitedMessageHandler(sending, receiving, this.CreateFormatter());
Expand Down
10 changes: 5 additions & 5 deletions test/StreamJsonRpc.Tests/StreamMessageHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async Task WriteAsync_ThrowsObjectDisposedException()
{
await this.handler.DisposeAsync();
ValueTask result = this.handler.WriteAsync(CreateNotifyMessage(), this.TimeoutToken);
Assert.Throws<ObjectDisposedException>(() => result.GetAwaiter().GetResult());
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await result);
}

/// <summary>
Expand All @@ -93,7 +93,7 @@ public async Task WriteAsync_ThrowsObjectDisposedException()
public async Task WriteAsync_PreferOperationCanceledException_AtEntry()
{
await this.handler.DisposeAsync();
Assert.Throws<OperationCanceledException>(() => this.handler.WriteAsync(CreateNotifyMessage(), PrecanceledToken).GetAwaiter().GetResult());
await Assert.ThrowsAsync<OperationCanceledException>(async () => await this.handler.WriteAsync(CreateNotifyMessage(), PrecanceledToken));
}

/// <summary>
Expand Down Expand Up @@ -143,8 +143,8 @@ public async Task ReadAsync_ThrowsObjectDisposedException()
{
await this.handler.DisposeAsync();
ValueTask<JsonRpcMessage?> result = this.handler.ReadAsync(this.TimeoutToken);
Assert.Throws<ObjectDisposedException>(() => result.GetAwaiter().GetResult());
Assert.Throws<OperationCanceledException>(() => this.handler.ReadAsync(PrecanceledToken).GetAwaiter().GetResult());
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await result);
await Assert.ThrowsAsync<OperationCanceledException>(async () => await this.handler.ReadAsync(PrecanceledToken));
}

/// <summary>
Expand All @@ -155,7 +155,7 @@ public async Task ReadAsync_ThrowsObjectDisposedException()
public async Task ReadAsync_PreferOperationCanceledException_AtEntry()
{
await this.handler.DisposeAsync();
Assert.Throws<OperationCanceledException>(() => this.handler.ReadAsync(PrecanceledToken).GetAwaiter().GetResult());
await Assert.ThrowsAsync<OperationCanceledException>(async () => await this.handler.ReadAsync(PrecanceledToken));
}

/// <summary>
Expand Down

0 comments on commit 665201f

Please sign in to comment.