Skip to content

Commit

Permalink
Update to .net 8 (#25)
Browse files Browse the repository at this point in the history
* Update to .net 8 sdk.

* Update NuGet packages.
  • Loading branch information
xavierjohn authored Dec 8, 2023
1 parent 0453d1b commit c9829ef
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<SolutionDir Condition=" '$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined if not building a solution or within Visual Studio*' ">$(MSBuildThisFileDirectory)</SolutionDir>
<IsTestProject>$(MSBuildProjectName.EndsWith('.Tests'))</IsTestProject>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>Latest</LangVersion>
Expand Down
22 changes: 11 additions & 11 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project>
<!-- Runtime -->
<ItemGroup>
<PackageVersion Include="Asp.Versioning.Http" Version="7.0.1" />
<PackageVersion Include="Asp.Versioning.Mvc" Version="7.0.1" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="7.0.1" />
<PackageVersion Include="Asp.Versioning.Http" Version="8.0.0" />
<PackageVersion Include="Asp.Versioning.Mvc" Version="8.0.0" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.0.0" />
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.1.1" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="7.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="7.0.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.0" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.5.1" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.5.1" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<!-- Test -->
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit.categories" Version="2.0.6" />
<PackageVersion Include="Xunit.DependencyInjection" Version="8.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
</ItemGroup>
</Project>
6 changes: 2 additions & 4 deletions ServiceLevelIndicators.Asp/src/HttpContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public static class HttpContextExtensions
/// <exception cref="InvalidOperationException">If the route does not emit SLI information and therefore MeasuredOperationLatency does not exist.</exception>
public static MeasuredOperationLatency GetMeasuredOperationLatency(this HttpContext context)
{
if (context == null)
throw new ArgumentNullException(nameof(context));
ArgumentNullException.ThrowIfNull(context);

return context.Features.GetRequiredFeature<IServiceLevelIndicatorFeature>().MeasuredOperationLatency;
}
Expand All @@ -31,8 +30,7 @@ public static MeasuredOperationLatency GetMeasuredOperationLatency(this HttpCont
/// <exception cref="ArgumentNullException"></exception>
public static bool TryGetMeasuredOperationLatency(this HttpContext context, [MaybeNullWhen(false)] out MeasuredOperationLatency measuredOperationLatency)
{
if (context == null)
throw new ArgumentNullException(nameof(context));
ArgumentNullException.ThrowIfNull(context);

if (context.Features.Get<IServiceLevelIndicatorFeature>() is IServiceLevelIndicatorFeature feature)
{
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.302",
"version": "8.0.100",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
Expand Down
2 changes: 1 addition & 1 deletion sample/WebApi/Controllers/WeatherForecastController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public IEnumerable<WeatherForecast> Get(string customerResourceId)
return GetWeather();
}

private static IEnumerable<WeatherForecast> GetWeather()
private static WeatherForecast[] GetWeather()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public int CustomAttribute(string attribute, string value)
return 7;
}

private static IEnumerable<WeatherForecast> GetWeather()
private static WeatherForecast[] GetWeather()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.1",
"version": "8.0-alpha.{height}",
"nuGetPackageVersion": {
"semVer": 2.0
},
Expand Down

0 comments on commit c9829ef

Please sign in to comment.