EasyLayout icon indicating copy to clipboard operation
EasyLayout copied to clipboard

Invalid casts on net6.0-ios

Open Fammy opened this issue 2 years ago • 0 comments

Frank Frank Frank,

I'm porting my 8+ year old Xamarin native app to .NET 6. I've run into two small issues with EasyLayout.

The Convert.ToDouble and Convert.ToSingle calls on these two lines throw exceptions because of the nfloat changes in net6.0-ios.

https://github.com/praeclarum/EasyLayout/blob/master/EasyLayout/Layout.cs#L177

https://github.com/praeclarum/EasyLayout/blob/master/EasyLayout/Layout.cs#L218

Both work if you cast the result of the Eval() to a nfloat and then use the .Value property when calling Convert.ToSingle or ToDouble. A fix for .NET 6, but not older versions.

Example of the fix:

var value = (nfloat)Eval(r);
add = (nfloat)Convert.ToDouble(nf.Value);

Also, the nuget doesn't support net6.0-ios yet, which is not a deal breaker because the source is just a single file.

If you'd like this in PR form, I can do that, but will need some time.

(sqlite-net-pcl is working great thus far.)

Thanks for your awesome contributions to open source!

Fammy avatar Sep 01 '22 20:09 Fammy