- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm currently coding a C# .NET macro for AutoCAD that needs to make a [GET] Api call. Retrieving the content string of the API call works fine, but when I try to deserialize the response string using Flurl or Newton, the AutoCAD crashes with a FATAL ERROR.
And when I try to deserialize the response using:
using JsonSerializer = System.Text.Json.JsonSerializer;for this code:
using HttpClient httpClient = new HttpClient();
HttpResponseMessage result1 = await httpClient.GetAsync(apiUrl);
string result2 = await result1.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<List<SubAssemblyTypeDto>>(result2, _jsonSerializerOptions); I get this error: Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Le fichier spécifié est introuvable.
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
Then when I install the demanded version of System.Memory, I get this error: Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Le fichier spécifié est introuvable.
at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
Why is it so complex to deserialize Json strings within the AutoCAD .NET environment? Is there any simpler way?
Thank you!
Solved! Go to Solution.