.NET MAUI: Android Bug – Map’s MoveToRegion Method Not Updating Visible Region

This content has 2 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.In the realm of software development, encountering bugs is an inevitable part of the process. In this blog post, we will delve into a bug specific to the Android platform in .NET MAUI applications. This bug affects the Map control, where the MoveToRegion method fails to update the visible region under certain circumstances. We will explore the symptoms of this bug and present a workaround that involves creating a custom child class of the Map control and overriding the OnPropertyChanged method of the IsVisible property. Symptoms The bug we are addressing pertains to the Map control in .NET MAUI applications on the Android platform. In some cases, the MoveToRegion method fails to modify the visible region of the map, resulting in the region staying the same despite the attempted change. This issue can lead to inconsistencies in map display and user experience. Workaround To overcome this bug, we can implement a workaround that involves creating a custom child class of the Map control and overriding the OnPropertyChanged method of the IsVisible property. By introducing a small delay and invoking the MoveToRegion method on the UI thread, we can ensure that the visible region updates correctly. Begin by creating a new class that derives from the Map control. This class will serve as a custom child class that incorporates the necessary…

Xamarin.iOS : “Failed to compile the generated registrar code” on Visual Studio for Mac

This content has 2 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.If you have recently upgraded your XCode version to 14.0, and installed the XCode command line tools too, you will probably notice some error messages when trying to run your Xamarin.Forms, or iOS application from Visual Studio for Mac. What actually helped me, is this:Navigate to https://developer.apple.com/download/all/ and search for Command Line Tools for Xcode 13.4 and Xcode 13.4. Both downloads are big, the XCode itself around 10GB and the CL Tools are around 1GB, so definitely do not do this on metered connections. Once the downloads are ready, open the XCode.XP file with the Package Archiver, let it extract to downloads, then move it to Applications folder. After that, install CL tools. Follow the installer’s instructions. Boom, it’s solved. Issue reported at: https://github.com/xamarin/xamarin-macios/issues/15954

Xamarin.UWP: Image from embedded resource throws “Operation is not supported on this platform” error

This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind. If you are getting the error “Operation is not supported on this platform” when you are trying to set an ImageResource from file for an image on Xamarin.UWP, then the problem comes from this line of code: The solution: Image as Embadded Ressource shows “operation is not supported on this platform” in UWP and Release (microsoft.com)In a short brief: You need to use the second parameter for FromResource method call. You must pass an assembly in order to success on UWP platform. iOS and Android is not affected with this error.