Skip to content

Commit

Permalink
💚⬆️net7 to net8 (LTS), net9 (STS) (#1502)
Browse files Browse the repository at this point in the history
Fixes CI build due to net7 no longer being available.

New convention for target frameworks:
- netstandard2.0
- latest LTS version (net8.0)
- any newer STS versions (net9.0)
  • Loading branch information
angularsen authored Jan 19, 2025
1 parent 53efbe5 commit d3cf2df
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion UnitsNet.NumberExtensions/UnitsNet.NumberExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>UnitsNet</RootNamespace>
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>UnitsNet.Serialization.JsonNet</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<!-- SourceLink: https://github.com/dotnet/sourcelink -->
Expand Down
3 changes: 2 additions & 1 deletion UnitsNet.Serialization.JsonNet/UnitsNetBaseJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ protected IQuantity ConvertValueUnit(ValueUnit valueUnit)

if (registeredQuantity is not null)
{
return (IQuantity)Activator.CreateInstance(registeredQuantity, valueUnit.Value, unit);
return (IQuantity)(Activator.CreateInstance(registeredQuantity, valueUnit.Value, unit) ??
throw new InvalidOperationException($"Failed to create instance of {registeredQuantity}."));
}

return valueUnit switch
Expand Down
2 changes: 1 addition & 1 deletion UnitsNet/UnitsNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>UnitsNet</RootNamespace>
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<!-- SourceLink: https://github.com/dotnet/sourcelink -->
Expand Down

0 comments on commit d3cf2df

Please sign in to comment.