minio / minio-dotnet

MinIO Client SDK for .NET
https://docs.min.io/docs/dotnet-client-quickstart-guide.html
Apache License 2.0
575 stars 230 forks source link

NullReferenceException If WithSSL(...) is omitted #1008

Open warappa opened 9 months ago

warappa commented 9 months ago

If one doesn't call WithSSL(...), then a NullReferenceException is triggered inside the MinIO library.

Steps To Reproduce

Given this code:

var services = new ServiceCollection();
services.AddMinio(client =>
{
    client
        .WithCredentials("minioadmin", "minioadmin")
        .WithEndpoint("127.0.0.1", 9000)
        //.WithSSL(false)
       ;
});

var serviceProvider = services.BuildServiceProvider();
var client = serviceProvider.GetRequiredService<IMinioClient>();

using var stream = File.OpenRead("test-data.json");

var putArgs = new PutObjectArgs()
    .WithBucket("spot-layouter-push")
    .WithObject("TestPut.json")
    .WithStreamData(stream)
    .WithObjectSize(stream.Length)
    .WithContentType("application/json");

await client.PutObjectAsync(putArgs);
  1. Have a test file greater than about 6MB
  2. Execute the code
  3. Error: NullReferenceException

Stacktrace

at Minio.DataModel.Response.NewMultipartUploadResponse..ctor(HttpStatusCode statusCode, String responseContent)
   at Minio.MinioClient.NewMultipartUploadAsync(NewMultipartUploadPutArgs args, CancellationToken cancellationToken)
   at Minio.MinioClient.PutObjectAsync(PutObjectArgs args, CancellationToken cancellationToken)

Expectations

Info

MinIO (NuGet): 6.0.2 MinIO (Server): 2024-02-06T21:36:22Z

ramondeklein commented 8 months ago

https://minio.slack.com/archives/C3NDUB8UA/p1711617745393569 may also be related to this.