C# SDK: How to determine if GetObjectAsync succeeded?
See original GitHub issueWhen accessing an object with a key that does not exist, the stream provided by GetObjectAsync
contains an XML error and does not throw and error when read, How should a caller avoid returning this XML error string in place of an actual string? I realize it is possible to call StatObjectAsync first, but that raises concerns about what happens if stat is called first, then before getobject a remove call is made.
Expected Behavior
I would expect an exception from GetObjectAsync if the object could not be retrieved.
Current Behavior
The stream contains an XML string:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Resource>/storagetest.f7f3da7a3a0b4ff299794b47161dccf6/Key Not Found</Resource><RequestId>15704FE60F942D64</RequestId><HostId>3L137</HostId></Error>
Possible Solution
- Provide a separate callback for the missing object scenario
- Provide a null stream
- Throw an exception
Steps to Reproduce (for bugs)
Call GetObjectAsync and provide a non-existing object key.
Context
I am concerned about concurrency problems with remove operations.
Your Environment
- Version used (
minio version
): 2018-12-13T02:04:19Z - Environment name and version (e.g. nginx 1.9.1): n/a
- Server type and version: n/a
- Operating System and version (
uname -a
): Windows 10 - Link to your project: n/a
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
AmazonS3Client.GetObjectAsync (GetObjectRequest, ...
Retrieves objects from Amazon S3. To use GET , you must have READ access to the object. If you grant READ access to...
Read more >Intermittent hang on S3 GetObjectAsync when called from ...
I am experiencing an issue where it appears that the GetObjectAsync call to retrieve the S3 object intermittently hangs.
Read more >c# - Determine if an object exists in a S3 bucket based on ...
I used the following code in C# with Amazon S3 version 3.1.5(.net 3.5) to check if the bucket exists: BasicAWSCredentials credentials = new ......
Read more >Upload/Download/Delete Files From AWS S3 Using .NET ...
In this article, we are going to explore about how to upload, download and delete the file(s) from AWS S3 and check if...
Read more >WMI Provider Log Files - Win32 apps
Verify that your computer is a member of a domain. CDSClassProvider::GetObjectAsync() GetClassFromCacheOrADSI FAILED for <class name> with ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fixed by #260
ok, I see a bug in this GetObjectAsync api call where we are not doing a stat prior to fetching - will fix it.
The other API call should work -