Skip to content

Commit

Permalink
Merge pull request #28 from Squidex/update-net8
Browse files Browse the repository at this point in the history
Update net8
SebastianStehle authored Nov 16, 2023
2 parents 992f24e + 868ea60 commit ee87200
Showing 95 changed files with 277 additions and 347 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -21,9 +21,18 @@ dotnet_diagnostic.RECS0117.severity = none
dotnet_diagnostic.SA0001.severity = none
dotnet_diagnostic.SA1649.severity = none

# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = none

# IDE0305: Simplify collection initialization
dotnet_diagnostic.IDE0305.severity = none

# CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = none

# CA1861: Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = none

# CA2016: Forward the 'CancellationToken' parameter to methods
dotnet_diagnostic.CA2016.severity = none

@@ -117,6 +126,9 @@ dotnet_diagnostic.RECS0154.severity = none
# SA1009: Closing parenthesis should be spaced correctly
dotnet_diagnostic.SA1009.severity = none

# SA1010: Opening square brackets should not be preceded by a space.
dotnet_diagnostic.SA1010.severity = none

# SA1011: Closing square brackets should be spaced correctly
dotnet_diagnostic.SA1011.severity = none

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
- name: setup dotnet
uses: actions/[email protected]
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: test
run: |
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
<PackageProjectUrl>https://github.com/squidex/squidex</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>5.22.0</Version>
<Version>6.0.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
6 changes: 3 additions & 3 deletions assets/Benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -2,16 +2,16 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
1 change: 0 additions & 1 deletion assets/Squidex.Assets.Azure/AzureBlobAssetStore.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System.IO;
using Azure;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
8 changes: 4 additions & 4 deletions assets/Squidex.Assets.Azure/Squidex.Assets.Azure.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
@@ -13,12 +13,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
8 changes: 4 additions & 4 deletions assets/Squidex.Assets.FTP/Squidex.Assets.FTP.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
@@ -13,12 +13,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentFTP" Version="46.0.2" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="FluentFTP" Version="48.0.3" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
@@ -13,12 +13,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Cloud.Storage.V1" Version="3.7.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="Google.Cloud.Storage.V1" Version="4.7.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>Squidex.Assets</RootNamespace>
@@ -12,13 +12,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.1.3" />
<PackageReference Include="Magick.NET.Core" Version="13.1.3" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.4.0" />
<PackageReference Include="Magick.NET.Core" Version="13.4.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Original file line number Diff line number Diff line change
@@ -154,15 +154,9 @@ protected override async Task FixCoreAsync(Stream source, string mimeType, Strea
throw new NotSupportedException();
}

var encoder = Configuration.Default.ImageFormatsManager.GetEncoder(image.Metadata.DecodedImageFormat);

if (encoder == null)
{
throw new NotSupportedException();
}
var encoder = Configuration.Default.ImageFormatsManager.GetEncoder(image.Metadata.DecodedImageFormat) ?? throw new NotSupportedException();

image.Mutate(x => x.AutoOrient());

image.Metadata.ExifProfile = null;
image.Metadata.IccProfile = null;
image.Metadata.IptcProfile = null;
8 changes: 1 addition & 7 deletions assets/Squidex.Assets.ImageSharp/Internal/Extensions.cs
Original file line number Diff line number Diff line change
@@ -33,13 +33,7 @@ public static IImageEncoder GetEncoder(this ResizeOptions options, IImageFormat?
throw new NotSupportedException();
}

var encoder = imageFormatsManager.GetEncoder(format);

if (encoder == null)
{
throw new NotSupportedException();
}

var encoder = imageFormatsManager.GetEncoder(format) ?? throw new NotSupportedException();
if (encoder is PngEncoder png && png.ColorType != PngColorType.RgbWithAlpha)
{
encoder = new PngEncoder
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>Squidex.Assets</RootNamespace>
@@ -13,16 +13,16 @@

<ItemGroup>
<PackageReference Include="Blurhash.ImageSharp" Version="3.0.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
</ItemGroup>

7 changes: 1 addition & 6 deletions assets/Squidex.Assets.Mongo/MongoGridFsAssetStore.cs
Original file line number Diff line number Diff line change
@@ -46,12 +46,7 @@ public async Task<long> GetSizeAsync(string fileName,
var fileQuery = await bucket.FindAsync(Filters.Eq(x => x.Id, name), cancellationToken: ct);
var fileObject = await fileQuery.FirstOrDefaultAsync(ct);

if (fileObject == null)
{
throw new AssetNotFoundException(fileName);
}

return fileObject.Length;
return fileObject == null ? throw new AssetNotFoundException(fileName) : fileObject.Length;
}

public async Task CopyAsync(string sourceFileName, string targetFileName,
8 changes: 4 additions & 4 deletions assets/Squidex.Assets.Mongo/Squidex.Assets.Mongo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
@@ -13,15 +13,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.20.0" />
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.22.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
</ItemGroup>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
8 changes: 4 additions & 4 deletions assets/Squidex.Assets.S3/Squidex.Assets.S3.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
@@ -13,12 +13,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.106.1" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.61">
<PackageReference Include="AWSSDK.S3" Version="3.7.300.3" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
6 changes: 2 additions & 4 deletions assets/Squidex.Assets.Tests/AssetStoreTests.cs
Original file line number Diff line number Diff line change
@@ -29,9 +29,7 @@ protected T Sut

protected AssetStoreTests()
{
#pragma warning disable MA0056 // Do not call overridable members in constructor
sut = new Lazy<T>(CreateStore);
#pragma warning restore MA0056 // Do not call overridable members in constructor
}

public abstract T CreateStore();
@@ -59,7 +57,7 @@ public async Task Should_not_be_able_to_store_files_in_parent_folder(string path
{
path = path.Replace("{file}", Guid.NewGuid().ToString(), StringComparison.Ordinal);

var data = new MemoryStream(new byte[] { 0x1, 0x2, 0x3, 0x4, 0x5 });
var data = new MemoryStream([0x1, 0x2, 0x3, 0x4, 0x5]);

await Assert.ThrowsAsync<InvalidOperationException>(() => Sut.UploadAsync(path, data, true));
}
@@ -287,7 +285,7 @@ public async Task Should_write_and_read_overrided_file(TestCase testCase)
{
var path = GetPath(testCase);

var oldData = new MemoryStream(new byte[] { 0x1, 0x2, 0x3, 0x4, 0x5 });
var oldData = new MemoryStream([0x1, 0x2, 0x3, 0x4, 0x5]);

await Sut.UploadAsync(path, oldData);
await Sut.UploadAsync(path, assetSmall, true);
4 changes: 2 additions & 2 deletions assets/Squidex.Assets.Tests/FolderAssetStoreTests.cs
Original file line number Diff line number Diff line change
@@ -28,14 +28,14 @@ public override FolderAssetStore CreateStore()
}

[Fact]
public void Should_throw_when_creating_directory_failed()
public async Task Should_throw_when_creating_directory_failed()
{
var options = Options.Create(new FolderAssetOptions
{
Path = CreateInvalidPath()
});

Assert.Throws<AssetStoreException>(() => new FolderAssetStore(options, A.Dummy<ILogger<FolderAssetStore>>()).InitializeAsync(default).Wait());
await Assert.ThrowsAsync<AssetStoreException>(() => new FolderAssetStore(options, A.Dummy<ILogger<FolderAssetStore>>()).InitializeAsync(default));
}

[Fact]
9 changes: 3 additions & 6 deletions assets/Squidex.Assets.Tests/HasherStreamTests.cs
Original file line number Diff line number Diff line change
@@ -44,13 +44,10 @@ private static byte[] GenerateTestData(int length = 1000)

private static string Sha256Base64(byte[] bytes)
{
using (var sha = SHA256.Create())
{
var bytesHash = sha.ComputeHash(bytes);
var bytesHash = SHA256.HashData(bytes);

var result = Convert.ToBase64String(bytesHash);
var result = Convert.ToBase64String(bytesHash);

return result;
}
return result;
}
}
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ namespace Squidex.Assets;

public sealed class MongoGridFSAssetStoreFixture : IDisposable
{
private readonly IMongoClient mongoClient = new MongoClient(TestHelpers.Configuration["assetStore:mongoDB:connectionString"]);
private readonly MongoClient mongoClient = new MongoClient(TestHelpers.Configuration["assetStore:mongoDB:connectionString"]);

public MongoGridFsAssetStore AssetStore { get; }

Loading

0 comments on commit ee87200

Please sign in to comment.