Cloudinary.Upload() throws a FormatException
@const-cloudinary đang làm issue này rồi.
Từ ngày 20/6/2021.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Hi, hope you're doing well.
I have the Cloudinary .NET SDK integrated with a Unity project. I've placed the CloudinaryDotNet DLL, as well as all of its DLL dependencies, inside my project. I'm able to access all the Cloudinary namespaces/classes/etc. from my code, which is fantastic.
Unfortunately, when I attempt a simple implementation of Cloudinary.Upload, I get a FormatException. Here's the problem code:
public void UploadImage()
{
ImageUploadParams uploadParams = new ImageUploadParams
{
File = new FileDescription("https://www.fnordware.com/superpng/pnggrad16rgb.png"), // Just a simple gradient image for testing
};
cloudinary.Upload(uploadParams); // FormatException is traced back to this line
}
Before the above method is called in my program, I'm setting my configuration parameters as outlined in the documentation, like this (with my actual info substituted):
Account account = new Account(
"my_cloud_name",
"my_api_key",
"my_api_secret");
Cloudinary cloudinary = new Cloudinary(account);
Here are the package versions I'm using:
- Cloudinary .NET SDK: 1.15.2
- Microsoft.AspNetCore.Html.Abstractions: 2.2.0
- Microsoft.AspNetCore.Http.Abstractions: 2.2.0
- Microsoft.AspNetCore.Http.Features: 2.2.0
- Microsoft.Extensions.DependencyInjection.Abstractions: 5.0.0
- Microsoft.Extensions.Options: 5.0.0
- Microsoft.Extensions.Primitives: 5.0.1
- Microsoft.Extensions.WebEncoders: 5.0.7
- System.Buffers: 4.5.1
- System.IO.Pipelines: 5.0.1
- System.Memory: 4.5.4
- System.Numerics.Vectors: 4.5.0
- System.Runtime.CompilerServices.Unsafe: 5.0.0
- System.Text.Encodings.Web: 5.0.1
- System.Threading.Tasks.Extensions: 4.5.4
Below is the FormatException that I'm getting:
FormatException: One of the identified items was in an invalid format.
System.Net.Http.Headers.HttpHeaders.AddInternal (System.String name, System.Collections.Generic.IEnumerable`1[T] values, System.Net.Http.Headers.HeaderInfo headerInfo, System.Boolean ignoreInvalid) (at <efff4cb93af94c0c950db61b78368b54>:0)
System.Net.Http.Headers.HttpHeaders.Add (System.String name, System.Collections.Generic.IEnumerable`1[T] values) (at <efff4cb93af94c0c950db61b78368b54>:0)
System.Net.Http.Headers.HttpHeaders.Add (System.String name, System.String value) (at <efff4cb93af94c0c950db61b78368b54>:0)
CloudinaryDotNet.ApiShared.PrePrepareRequestBody (System.Net.Http.HttpRequestMessage request, CloudinaryDotNet.HttpMethod method, System.Collections.Generic.Dictionary`2[TKey,TValue] extraHeaders) (at <0c3884533d824ad98e55170b6aba31df>:0)
CloudinaryDotNet.ApiShared+<PrepareRequestBodyAsync>d__75.MoveNext () (at <0c3884533d824ad98e55170b6aba31df>:0)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0)
CloudinaryDotNet.ApiShared+<CallAsync>d__58.MoveNext () (at <0c3884533d824ad98e55170b6aba31df>:0)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0)
CloudinaryDotNet.ApiShared+<CallAndParseAsync>d__56`1[T].MoveNext () (at <0c3884533d824ad98e55170b6aba31df>:0)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0)
CloudinaryDotNet.Cloudinary.Upload[T,TP] (TP parameters) (at <0c3884533d824ad98e55170b6aba31df>:0)
CloudinaryDotNet.Cloudinary.Upload (CloudinaryDotNet.Actions.ImageUploadParams parameters) (at <0c3884533d824ad98e55170b6aba31df>:0)
CloudinaryUploader.UploadImage () (at Assets/Scripts/_general/Cloudinary/CloudinaryUploader.cs:28)
I'm working on a Mac inside Unity 2021.1.3f1, which can use either .NET Standard 2.0 or .NET 4.x. Both APIs produce the above error.
Please let me know if there's any additional information I can provide.
Thank you so much. I would really appreciate any insight anyone might have.
All the best,
Galen
- Ngôn ngữ chính
- C#
- Star
- 105
- Fork
- 72
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cloudinary/CloudinaryDotNet
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
cloudinary/CloudinaryDotNet#387 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
cloudinary/CloudinaryDotNet#385 · 5 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
cloudinary/CloudinaryDotNet#383 · 1 bình luận ·
-
Create New Sample Project with Generative AI and Special Use CasesCó thể làm lại được @Nupoor10 đã nhận 768 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
cloudinary/CloudinaryDotNet#369 · 4 bình luận ·
-
Update the Sample ProjectCó thể làm lại được @arya2004 đã nhận 772 ngày trước và không có pull request nào đang mở. Đang mở
cloudinary/CloudinaryDotNet#368 · 4 bình luận · 1 người được giao ·
Tất cả issue của cloudinary/CloudinaryDotNet
Issue tương tự
-
ready-for-agent tech-debt
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
DigiBanks99/menlo#640 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
OpenTabletDriver/OpenTabletDriver#5283 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
area / templates
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
bitfoundation/bitplatform#15109 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
aikido critical security
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
dequelabs/axe-core-nuget#305 ·