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

add .Net6 support across codebase #732

Merged
merged 39 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6dfe822
Convert to json net
martijn00 Jan 12, 2023
3c2fb1e
Fix last stuff
martijn00 Jan 13, 2023
fe3433f
Update packages
martijn00 Jan 13, 2023
548a66f
Update minio-dotnet-windows.yml
martijn00 Jan 13, 2023
0eb6840
Update minio-dotnet-linux.yml
martijn00 Jan 13, 2023
6bb3193
Run dotnet regitlint
martijn00 Feb 7, 2023
1937219
Update package
martijn00 Feb 7, 2023
cac1d5c
Fix usings
martijn00 Feb 8, 2023
fd54815
Clean proj
martijn00 Feb 16, 2023
200bf1b
Fix messages
martijn00 Feb 16, 2023
b2b7094
Fix warnings
martijn00 Feb 16, 2023
b17f34f
Update tools
martijn00 Feb 17, 2023
5550214
Formatting
martijn00 Feb 17, 2023
e3000a1
Warning fixes
martijn00 Feb 17, 2023
de4f9bb
Formatting
martijn00 Feb 17, 2023
62e8313
Update functional tests
martijn00 Feb 17, 2023
91e338d
Fix simple sample
martijn00 Feb 17, 2023
1e7fa7f
Test fixes
martijn00 Feb 17, 2023
4052592
Fix more tests
martijn00 Feb 17, 2023
8b17f5c
Fix test
martijn00 Feb 17, 2023
06a1d5b
Show progress
martijn00 Feb 17, 2023
344c344
Format
martijn00 Feb 18, 2023
04a4841
Fix more
martijn00 Feb 18, 2023
6f0a408
Warnings
martijn00 Feb 18, 2023
5d991e3
Make output more readable
martijn00 Feb 20, 2023
88fc31d
Larger delay
martijn00 Feb 20, 2023
cefb7dd
Not dispose observable
martijn00 Feb 21, 2023
aead907
Update Minio/Credentials/IAMAWSProvider.cs
martijn00 Feb 24, 2023
1cfeb6d
Disable some analyzers
martijn00 Feb 24, 2023
50ee7b9
Warnings
martijn00 Feb 24, 2023
87543f1
More warnings
martijn00 Feb 24, 2023
d8ee45c
More cleanup
martijn00 Feb 24, 2023
2c5fda2
More warnings
martijn00 Feb 24, 2023
7ef94ce
Disable analyzers
martijn00 Feb 24, 2023
53ecb86
Fix lists
martijn00 Feb 28, 2023
df5c859
Disable pretty json
martijn00 Mar 1, 2023
cefeb7c
Adds 6.0.x to build version
ebozduman Mar 1, 2023
fc78579
Add docs back
martijn00 Mar 2, 2023
0006643
clean up print out
ebozduman Mar 4, 2023
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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2022.1.1",
"version": "2022.3.2",
"commands": [
"jb"
]
},
"regitlint": {
"version": "6.0.8",
"version": "6.3.10",
"commands": [
"regitlint"
]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/minio-dotnet-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ["6.0.x"]
dotnet-version: ["6.0.x", "7.0.x"]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
# Install the .NET
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/minio-dotnet-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
configuration: [Release]
dotnet-version: ["6.0.x"]
dotnet-version: ["6.0.x", "7.0.x"]

runs-on: windows-latest
env:
Expand All @@ -25,13 +25,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

# Install the .NET
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

Expand Down
90 changes: 90 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<Project>
<PropertyGroup>
<Copyright>Copyright (c) Minio. All rights reserved</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/minio/minio-dotnet</PackageProjectUrl>
<Authors>MinIO, Inc.</Authors>
<Owners>MinIO, Inc.</Owners>
<PackageTags>minio;cloud;storage</PackageTags>
<PackageReleaseNotes>https://github.com/minio/minio-dotnet/releases</PackageReleaseNotes>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<NeutralLanguage>en-US</NeutralLanguage>
<MinClientVersion>2.14</MinClientVersion>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryUrl>https://github.com/minio/minio-dotnet</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<Version>5.0.0</Version>

<!--<Nullable>enable</Nullable>-->
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<Platform>AnyCPU</Platform>

<EnableNETAnalyzers>false</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>

<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<!--<SymbolPackageFormat>snupkg</SymbolPackageFormat>-->
<IncludeSymbols>true</IncludeSymbols>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<DesignTimeBuild>false</DesignTimeBuild>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild Condition=" '$(IsTestProject)' != 'true'">true</GeneratePackageOnBuild>
<PackageIcon>icon.png</PackageIcon>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>

<PackageOutputPath>$(SolutionDir)artifacts</PackageOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\LICENSE" Pack="true" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)\icon.png" Pack="true" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)\readme.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<!--
<PackageReference Include="Roslynator.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="AsyncFixer" Version="1.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="IDisposableAnalyzers" Version="4.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ReflectionAnalyzers" Version="0.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
-->
</ItemGroup>

</Project>
10 changes: 4 additions & 6 deletions FileUploader/FileUpload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
* limitations under the License.
*/

using System;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Minio;

namespace FileUploader;
Expand All @@ -29,7 +27,7 @@ namespace FileUploader;
/// Either create a file with this name or change it with your own file,
/// where it is defined down below.
/// </summary>
public class FileUpload
public static class FileUpload
{
private static bool IsWindows()
{
Expand All @@ -47,7 +45,7 @@ private static void Main(string[] args)

try
{
var minio = new MinioClient()
using var minio = new MinioClient()
.WithEndpoint(endpoint)
.WithCredentials(accessKey, secretKey)
.WithSSL()
Expand Down Expand Up @@ -83,13 +81,13 @@ private static async Task Run(IMinioClient minio)
{
var bktExistArgs = new BucketExistsArgs()
.WithBucket(bucketName);
var found = await minio.BucketExistsAsync(bktExistArgs);
var found = await minio.BucketExistsAsync(bktExistArgs).ConfigureAwait(false);
if (!found)
{
var mkBktArgs = new MakeBucketArgs()
.WithBucket(bucketName)
.WithLocation(location);
await minio.MakeBucketAsync(mkBktArgs);
await minio.MakeBucketAsync(mkBktArgs).ConfigureAwait(false);
}

var putObjectArgs = new PutObjectArgs()
Expand Down
1 change: 0 additions & 1 deletion FileUploader/FileUploader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<IsPackable>False</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 3 additions & 5 deletions Minio.Examples/Cases/AWSEnvironmentProviderExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@
* limitations under the License.
*/

using System;
using System.Threading.Tasks;
using Minio.Credentials;
using Minio.Exceptions;

namespace Minio.Examples.Cases;

public class AWSEnvironmentProviderExample
public static class AWSEnvironmentProviderExample
{
// Establish Credentials with AWS IAM Credentials in Environmental variables
public static async Task Run()
{
var provider = new AWSEnvironmentProvider();
var minioClient = new MinioClient()
using var minioClient = new MinioClient()
.WithEndpoint("s3.amazonaws.com")
.WithSSL()
.WithCredentialsProvider(provider)
Expand All @@ -38,7 +36,7 @@ public static async Task Run()
var statObjectArgs = new StatObjectArgs()
.WithBucket("my-bucket-name")
.WithObject("my-object-name");
var result = await minioClient.StatObjectAsync(statObjectArgs);
var result = await minioClient.StatObjectAsync(statObjectArgs).ConfigureAwait(false);
Console.WriteLine("Object Stat: \n" + result);
}
catch (MinioException me)
Expand Down
12 changes: 5 additions & 7 deletions Minio.Examples/Cases/AssumeRoleProviderExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
// limitations under the License.
//

using System;
using System.Threading.Tasks;
using Minio.Credentials;

namespace Minio.Examples.Cases;

public class AssumeRoleProviderExample
public static class AssumeRoleProviderExample
{
// Establish Authentication by assuming the role of an existing user
public static async Task Run()
Expand All @@ -35,7 +33,7 @@ public static async Task Run()
// Secret key to fetch credentials from STS endpoint.
var secretKey = "secret-key";

var minio = new MinioClient()
using var minio = new MinioClient()
.WithEndpoint(endpoint)
.WithCredentials(accessKey, secretKey)
.WithSSL()
Expand All @@ -44,9 +42,9 @@ public static async Task Run()
{
var provider = new AssumeRoleProvider(minio);

var token = await provider.GetCredentialsAsync();
var token = await provider.GetCredentialsAsync().ConfigureAwait(false);
// Console.WriteLine("\nToken = "); utils.Print(token);
var minioClient = new MinioClient()
using var minioClient = new MinioClient()
.WithEndpoint(endpoint)
.WithCredentials(token.AccessKey, token.SecretKey)
.WithSessionToken(token.SessionToken)
Expand All @@ -56,7 +54,7 @@ public static async Task Run()
var statObjectArgs = new StatObjectArgs()
.WithBucket("bucket-name")
.WithObject("object-name");
var result = await minio.StatObjectAsync(statObjectArgs);
var result = await minio.StatObjectAsync(statObjectArgs).ConfigureAwait(false);
// Console.WriteLine("Object Stat: \n"); utils.Print(result);
Console.WriteLine("AssumeRoleProvider test PASSed\n");
}
Expand Down
7 changes: 2 additions & 5 deletions Minio.Examples/Cases/BucketExists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
* limitations under the License.
*/

using System;
using System.Threading.Tasks;

namespace Minio.Examples.Cases;

internal class BucketExists
internal static class BucketExists
{
// Check if a bucket exists
public static async Task Run(IMinioClient minio,
Expand All @@ -30,7 +27,7 @@ internal class BucketExists
Console.WriteLine("Running example for API: BucketExistsAsync");
var args = new BucketExistsArgs()
.WithBucket(bucketName);
var found = await minio.BucketExistsAsync(args);
var found = await minio.BucketExistsAsync(args).ConfigureAwait(false);
Console.WriteLine((found ? "Found" : "Couldn't find ") + "bucket " + bucketName);
Console.WriteLine();
}
Expand Down
48 changes: 22 additions & 26 deletions Minio.Examples/Cases/CertificateIdentityProviderExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
// limitations under the License.
//

using System;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Minio.Credentials;

namespace Minio.Examples.Cases;

public class CertificateIdentityProviderExample
public static class CertificateIdentityProviderExample
{
// Establish Authentication on both ways with client and server certificates
public static async Task Run()
Expand All @@ -32,32 +30,30 @@ public static async Task Run()

// Generatng pfx cert for this call.
// openssl pkcs12 -export -out client.pfx -inkey client.key -in client.crt -certfile server.crt
using (var cert = new X509Certificate2("C:\\dev\\client.pfx", "optional-password"))
using var cert = new X509Certificate2("C:\\dev\\client.pfx", "optional-password");
try
{
try
{
var provider = new CertificateIdentityProvider()
.WithStsEndpoint(stsEndpoint)
.WithCertificate(cert)
.Build();
var provider = new CertificateIdentityProvider()
.WithStsEndpoint(stsEndpoint)
.WithCertificate(cert)
.Build();

var minioClient = new MinioClient()
.WithEndpoint("alias:port")
.WithSSL()
.WithCredentialsProvider(provider)
.Build();
using var minioClient = new MinioClient()
.WithEndpoint("alias:port")
.WithSSL()
.WithCredentialsProvider(provider)
.Build();

var statObjectArgs = new StatObjectArgs()
.WithBucket("bucket-name")
.WithObject("object-name");
var result = await minioClient.StatObjectAsync(statObjectArgs);
// Console.WriteLine("\nObject Stat: \n" + result.ToString());
Console.WriteLine("\nCertificateIdentityProvider test PASSed\n");
}
catch (Exception e)
{
Console.WriteLine($"\nCertificateIdentityProvider test exception: {e}\n");
}
var statObjectArgs = new StatObjectArgs()
.WithBucket("bucket-name")
.WithObject("object-name");
var result = await minioClient.StatObjectAsync(statObjectArgs).ConfigureAwait(false);
// Console.WriteLine("\nObject Stat: \n" + result.ToString());
Console.WriteLine("\nCertificateIdentityProvider test PASSed\n");
}
catch (Exception e)
{
Console.WriteLine($"\nCertificateIdentityProvider test exception: {e}\n");
}
}
}
Loading