The problem ‘Failed to compile the generated registrar code’ is seen when you are working on Xcode and are trying to deploy Xamarin on your iPhone this is the case when you are specifically working on Xcode version 14
Given below is the snippet of the problem ‘Xcode that doesn’t support iOS 15.6’ that you would see when you try to run your xamarin project on your iPhone:
Failed to compile the generated registrar code. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
Error ‘Failed to compile the generated registrar code’ is seen because there is no support available for the Xamarin apps with VS Mac in the latest update of Xcode to the version 14.
The lack of Xcode 14.0 beta testing in the VS (Mac) Preview channel before the product is released to the public is pretty alarming.
The only valid workaround towards this error is to use a previous version xcode to use the Xamarin apps in your iPhone.
To fix the error “Failed to compile the generated registrar code”, downgrade Command Line Tools from version 14.0 to 13.4 following steps Preferences -> Location -> Command Line Tools and change version 13.4 and restart.
Change version 14. to 13.4 in Xcode (still version 14) -> Preferences -> Location -> Command Line Tools. Restarting the tools can help you solve your error.
Steps to Fix the problem ‘Failed to compile the generated registrar code.’ Android Studio:
Method 1: Downgrading to Xcode version 13.4.1
The first step for you is that you can try downgrading your Command Line Tools to 13.4 this can help you solve the error and can help your fix your error.
To do so you will have to change version 14. to 13.4 in xCode (still version 14) -> Preferences -> Location -> Command Line Tools. Restarting the tools can help you solve your error.
You can use the image given below as a reference to solve your error and downgrade your Command Line Tools to 13.4:

The only valid workaround towards this error is to use a previous version xcode to use the Xamarin apps in your iPhone as there is no support available for the Xamarin apps with VS Mac in the latest update of xcode to the version 14.
This should help you fix and understand the problem, ‘Xcode that doesn’t support iOS 15.6’ Android Studio.
Conclusion
The only effective solution for the error, “Failed to compile the generated registrar code” is to use an earlier version of xcode to utilise Xamarin applications on your iPhone because the most recent update of xcode to version 14 does not allow Xamarin apps with Visual Studio Mac.