plneto / Synology.Api.Client

.NET/C# client for the Synology API
MIT License
20 stars 12 forks source link

Not compatible with .NET MAUI #8

Closed FroggieFrog closed 1 year ago

FroggieFrog commented 1 year ago

I ran into an issue with this library while developing a MAUI App. When uploading a file via SYNO.FileStation.Upload there is always an exception (Object is already disposed). The origin of this exception is Flurl.Http. A new prerelease of this lib seems to be compatible, but replaces Newtonsoft.Json with System.Text.Json which causes some issues with this lib. This lib targets netstandard2.0 so in theory it should be compatible with MAUI, but is not because of a dependency (Flurl).

Are there plans to make this lib compatible with MAUI?

plneto commented 1 year ago

I don't have an environment where I can test this library in a MAUI app at the moment. Would you be able to help find a solution?

FroggieFrog commented 1 year ago

A possible solution is to not use Flurl.Http and Newtonsoft.Json and do it all manually. This would actually be kind of an entire rewrite of this lib. I'm not sure if this is a thing you would like to do.

plneto commented 1 year ago

Yeah, that would be a lot of work. How about re-writing only the Upload method manually? Can you see if it works?

Did you try both overloads from UploadAsync? There's one that uses a byte array and one that uses a file path.

PeskovV commented 1 year ago

@FroggieFrog Hi! You can try new (pre) version of Flurl: https://www.nuget.org/packages/Flurl.Http/4.0.0-pre3#dependencies-body-tab It doesn't depend on Newtonsoft and depends on .net 6