Skip to content
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 dotnet8 #164

Merged
merged 2 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
4 changes: 2 additions & 2 deletions Autodesk.Forge.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.106
# Visual Studio Version 17
VisualStudioVersion = 17.10.34928.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Autodesk.Forge.Core", "src\Autodesk.Forge.Core\Autodesk.Forge.Core.csproj", "{E59655EF-C1BF-4318-B344-B2C6B67E1A74}"
EndProject
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 4.0.0.0

* Migrate to .Net 8

### 3.0.0.0

* Migrate to .Net 6
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
2 changes: 2 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

### Requirements

- .NET 6 or later
- .NET 8 or later

### Dependencies

- [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) 13.0.1 or later
- [Polly](https://github.com/App-vNext/Polly) 7.2.3 or later
- [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
- [Polly](https://github.com/App-vNext/Polly)

### Changelog

Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Autodesk Forge Team</Authors>
<Company>Autodesk</Company>
<Product>Autodesk Forge</Product>
<Description>Shared code for Forge client sdks e2e tests</Description>
<Copyright>Autodesk Inc.</Copyright>
<Version>3.0.1</Version>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Autodesk-Forge/forge-api-dotnet-core</PackageProjectUrl>
<PackageIcon>logo_forge-2-line.png</PackageIcon>
<PackageReleaseNotes>For full release notes see https://github.com/Autodesk-Forge/forge-api-dotnet-core/blob/master/CHANGELOG.md</PackageReleaseNotes>
<PackageVersion>4.0.0</PackageVersion>
<IsTestProject>false</IsTestProject>
<NoWarn>NU5100</NoWarn>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\images\logo_forge-2-line.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="xunit.assert" Version="2.6.4" />
<PackageReference Include="xunit.core" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="xunit.assert" Version="2.8.1" />
<PackageReference Include="xunit.core" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<IsTestProject>false</IsTestProject>
</PropertyGroup>

<Import Project="../../nuget.targets" />
</Project>
32 changes: 7 additions & 25 deletions src/Autodesk.Forge.Core/Autodesk.Forge.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Autodesk Forge</Authors>
<owners>Autodesk Forge</owners>
<Company>Autodesk</Company>
<Product>Autodesk Forge</Product>
<Description>Shared code for Forge client sdks</Description>
<Copyright>Autodesk Inc.</Copyright>
<Version>3.0.2</Version>
<AssemblyVersion>3.0.2.0</AssemblyVersion>
<FileVersion>3.0.2.0</FileVersion>
<PackageId>Autodesk.Forge.Core</PackageId>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Autodesk-Forge/forge-api-dotnet-core</PackageProjectUrl>
<PackageIcon>logo_forge-2-line.png</PackageIcon>
<PackageReleaseNotes>For full release notes see https://github.com/Autodesk-Forge/forge-api-dotnet-core/blob/master/CHANGELOG.md</PackageReleaseNotes>
<Description>Shared code for APS client sdks</Description>
<PackageVersion>4.0.0</PackageVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\images\logo_forge-2-line.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.2.1" />
<PackageReference Include="Polly" Version="8.4.0" />
</ItemGroup>

<Import Project="../../nuget.targets" />
</Project>
20 changes: 20 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Autodesk</Authors>
<Copyright>Autodesk Inc.</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Autodesk-Forge/forge-api-dotnet-core</PackageProjectUrl>
<PackageIcon>logo_forge-2-line.png</PackageIcon>
<PackageReleaseNotes>For full release notes see https://github.com/Autodesk-Forge/forge-api-dotnet-core/blob/master/CHANGELOG.md</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\images\logo_forge-2-line.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions nuget.targets → src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
<!-- Push the nuget package that this project builds to nuget.org
Ignore exit code so failures including the value of NugetApiKey do not get echo-ed.
Continue on errors. Publishing can fail if the package version isn't updated and we get conflict.
-->
<Target Name="Push" DependsOnTargets="Pack">
<Exec Command="dotnet nuget push @(NuGetPackOutput->WithMetadataValue('Extension','.nupkg')) -k=$(NugetApiKey) -s nuget.org"
<Exec Command="dotnet nuget push @(NuGetPackOutput->WithMetadataValue('Extension','.nupkg')) -k=$(NugetApiKey) -s nuget.org"
IgnoreExitCode="true"
ContinueOnError="true"/>
</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion tests/Autodesk.Forge.Core.Test/TestForgeAgentHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Autodesk.Forge.Core.Test
public class TestForgeAgentHandler
{
[Fact]
public async void TestUser()
public async Task TestUser()
{
var json = @"
{
Expand Down
30 changes: 15 additions & 15 deletions tests/Autodesk.Forge.Core.Test/TestForgeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public void TestNullConfigurationThrows()
}

[Fact]
public async void TestNoRequestUriThrows()
public async Task TestNoRequestUriThrows()
{
var fh = new HttpMessageInvoker(new ForgeHandler(Options.Create(new ForgeConfiguration())));
await Assert.ThrowsAsync<ArgumentNullException>($"{nameof(HttpRequestMessage)}.{nameof(HttpRequestMessage.RequestUri)}", () => fh.SendAsync(new HttpRequestMessage(), CancellationToken.None));
}

[Fact]
public async void TestNoClientIdThrows()
public async Task TestNoClientIdThrows()
{
var fh = new HttpMessageInvoker(new ForgeHandler(Options.Create(new ForgeConfiguration())));
var req = new HttpRequestMessage();
Expand All @@ -54,7 +54,7 @@ public async void TestNoClientIdThrows()
}

[Fact]
public async void TestNoClientSecretThrows()
public async Task TestNoClientSecretThrows()
{
var fh = new HttpMessageInvoker(new ForgeHandler(Options.Create(new ForgeConfiguration() { ClientId = "ClientId" })));
var req = new HttpRequestMessage();
Expand All @@ -64,7 +64,7 @@ public async void TestNoClientSecretThrows()
}

[Fact]
public async void TestFirstCallAuthenticates()
public async Task TestFirstCallAuthenticates()
{
var sink = new Mock<HttpMessageHandler>(MockBehavior.Strict);
sink.Protected().As<HttpMessageInvoker>().SetupSequence(o => o.SendAsync(It.IsAny<HttpRequestMessage>(), It.IsAny<CancellationToken>()))
Expand Down Expand Up @@ -97,7 +97,7 @@ public async void TestFirstCallAuthenticates()
}

[Fact]
public async void TestFirstCallAuthenticatesNonDefaultUser()
public async Task TestFirstCallAuthenticatesNonDefaultUser()
{
var req = new HttpRequestMessage();
var config = new ForgeConfiguration()
Expand Down Expand Up @@ -153,7 +153,7 @@ public async void TestFirstCallAuthenticatesNonDefaultUser()
}

[Fact]
public async void TestRetryOnceOnAuthenticationFailure()
public async Task TestRetryOnceOnAuthenticationFailure()
{
var newToken = "newToken";
var cachedToken = "cachedToken";
Expand Down Expand Up @@ -202,7 +202,7 @@ public async void TestRetryOnceOnAuthenticationFailure()
}

[Fact]
public async void TestRefreshExpiredToken()
public async Task TestRefreshExpiredToken()
{
var newToken = "newToken";
var cachedToken = "cachedToken";
Expand Down Expand Up @@ -245,7 +245,7 @@ public async void TestRefreshExpiredToken()
}

[Fact]
public async void TestRefreshExpiredTokenByOneThreadOnly()
public async Task TestRefreshExpiredTokenByOneThreadOnly()
{
var newToken = "newToken";
var cachedToken = "cachedToken";
Expand Down Expand Up @@ -300,7 +300,7 @@ public async void TestRefreshExpiredTokenByOneThreadOnly()
}

[Fact]
public async void TestUseGoodToken()
public async Task TestUseGoodToken()
{
var cachedToken = "cachedToken";
var req = new HttpRequestMessage();
Expand Down Expand Up @@ -339,7 +339,7 @@ public async void TestUseGoodToken()
}

[Fact]
public async void TestNoRefreshOnClientProvidedToken()
public async Task TestNoRefreshOnClientProvidedToken()
{
var token = "blabla";
var req = new HttpRequestMessage();
Expand Down Expand Up @@ -382,7 +382,7 @@ public async void TestNoRefreshOnClientProvidedToken()
public class TestForgeHandler2
{
[Fact]
public async void TestCorrectNumberOfRetries()
public async Task TestCorrectNumberOfRetries()
{
var cachedToken = "cachedToken";
var req = new HttpRequestMessage();
Expand Down Expand Up @@ -431,7 +431,7 @@ public async void TestCorrectNumberOfRetries()
public class TestForgeHandler3
{
[Fact]
public async void TestTimeout()
public async Task TestTimeout()
{
var cachedToken = "cachedToken";
var req = new HttpRequestMessage();
Expand Down Expand Up @@ -470,7 +470,7 @@ public async void TestTimeout()
public class TestForgeHandler4
{
[Fact]
public async void TestCircuitBreaker()
public async Task TestCircuitBreaker()
{
var cachedToken = "cachedToken";
var req = new HttpRequestMessage();
Expand Down Expand Up @@ -529,7 +529,7 @@ public class TestCustomTimeout
};

[Fact]
public async void TestTriggeredTimeout()
public async Task TestTriggeredTimeout()
{
var (sink, requestSender) = GetReady(1, TimeSpan.FromMilliseconds(1100));
await Assert.ThrowsAsync<Polly.Timeout.TimeoutRejectedException>(async () => await requestSender());
Expand All @@ -538,7 +538,7 @@ public async void TestTriggeredTimeout()
}

[Fact]
public async void TestNoTimeout()
public async Task TestNoTimeout()
{
var (sink, requestSender) = GetReady(1, TimeSpan.FromMilliseconds(100));

Expand Down
10 changes: 5 additions & 5 deletions tests/Autodesk.Forge.Core.Test/TestMarshalling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ namespace Autodesk.Forge.Core.Test
public class TestMarshalling
{
[Fact]
public async void TestDeserializeThrowsOnNull()
public async Task TestDeserializeThrowsOnNull()
{
await Assert.ThrowsAsync<ArgumentNullException>(() => Marshalling.DeserializeAsync<string>(null));
}

[Fact]
public async void TestDeserializeNonJsonThrows()
public async Task TestDeserializeNonJsonThrows()
{
await Assert.ThrowsAsync<ArgumentException>(() => Marshalling.DeserializeAsync<string>(new ByteArrayContent(new byte[] { 0, 2, 3 })));
}

[Fact]
public async void TestDeserializeValidString()
public async Task TestDeserializeValidString()
{
var ret = await Marshalling.DeserializeAsync<string>(new StringContent("\"bla\"", Encoding.UTF8, "application/json"));
Assert.Equal("bla", ret);
}

[Fact]
public async void TestDeserializeNull()
public async Task TestDeserializeNull()
{
var ret = await Marshalling.DeserializeAsync<string>(new StringContent("null", Encoding.UTF8, "application/json"));
Assert.Null(ret);
}

[Fact]
public async void TestDeserializeNullInvalid()
public async Task TestDeserializeNullInvalid()
{
await Assert.ThrowsAsync <Newtonsoft.Json.JsonSerializationException>(() => Marshalling.DeserializeAsync<int>(new StringContent("null", Encoding.UTF8, "application/json")));
}
Expand Down