xamarin / Xamarin.PropertyEditing

MIT License
24 stars 16 forks source link

Add cast to fix bug with numeric conversion #794

Closed BretJohnson closed 2 years ago

BretJohnson commented 2 years ago

With the macos P13 API type changes, an issue was introduced since casting an ObjCRuntime.nfloat to an nint (aka IntPtr) doesn't work properly - (nint)(ObjCRuntime.nfloat)23 for instance will evaluate to 0x4037000000000000, the floating point bits are just reinterpreted as an int rather than actually being converted.

That in turn caused huge sizes for width and height causing new CGBitmapContext to throw an exception.

Adding the double cast here fixes this, for now.

Soon ObjCRuntime.nfloat will go away, replaced by System.Runtime.InteropServices.NFloat, but for now this workaround makes us work.

Fixes: AB#1487089 AB#1487070 AB#1487047

BretJohnson commented 2 years ago

@gitbot backport main

vs-mobiletools-engineering-service2 commented 2 years ago

Backport Job to branch main Created! The magic is happening here

vs-mobiletools-engineering-service2 commented 2 years ago

Hooray! Backport succeeded! Please see https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=5799997 for more details.