text: Q:
  
  How to enter commands in the debugger of Xamarin Studio
  
  I want to enter the following command into the debugger
  po [[UIWindow keyWindow] _autolayoutTrace] 
  
  How would I do that in Xamarin Studio?
  Edit:
  I saw this Objective-C code
  NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]);
  
  in programatically change autolayout on orientation change together with an interface definition for that.
  // for debugging auto layout.
  @interface UIWindow (AutoLayoutDebug)
  +(UIWindow *)keyWindow;
  -(NSString *)_autolayoutTrace;
  @end
  
  I'd like to know how this can be done in Xamarin iOS?
  
  A:
  
  If you are using the unified API the solution posted by miguel.de.icaza doesn't work anymore, because you get
  
  `ObjCRuntime.Messaging' is inaccessible due to its protection level
  
  One has to use P/Invoke:
  using System;
  using System.Runtime.InteropServices;
  
  using Foundation;
  using UIKit;
  using ObjCRuntime;
  
  public static class UIViewAutolayoutTraceExtensions
  {
      [DllImport(Constants.ObjectiveCLibrary, EntryPoint="objc_msgSend")]
      private static extern IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector);
  
      public static NSString AutoLayoutTrace(){
          return (NSString)Runtime.GetNSObject(IntPtr_objc_msgSend(UIApplication.SharedApplication.KeyWindow.Handle, new Selector ("_autolayoutTrace").Handle));
      }
  
      public static NSString RecursiveDescription(){
          return (NSString)Runtime.GetNSObject(IntPtr_objc_msgSend(UIApplication.SharedApplication.KeyWindow.Handle, new Selector ("recursiveDescription").Handle));
      }
  }
  
  Then you can use it like this:
  Console.WriteLine(UIViewAutolayoutTraceExtensions.RecursiveDescription ());
  
  One caveat though: You can only call this code after everything has been loaded. Otherwise KeyWindow will be null. So there is no possibility to set a breakpoint and then call this code. You can only call this code if you provide a button or something similar with which you trigger the action.
  
  A:
  
  using MonoTouch.ObjCRuntime;
  
  var str = new NSString (Messaging.IntPtr_objc_msgSend (UIApplication.SharedApplication.KeyWindow.Handle, new Selector ("_autolayoutTrace").Handle));
  
  And "str" will contain the string that you can then use with Console.WriteLine
  
  