Enable Autolayout diagnosis messages in debug output

JuliusZintJuliusZint USMember

Autolayout diagnosis messages do not appear in the output window of Visual Studio for Mac when developing a Xamarin.Mac application.

2018-07-11 15:25:37.278996+0200 test[2765:830514] [Layout] Unable to simultaneously satisfy constraints: ...

To reproduce this just create a new Solution with the Cocoa App template and add the following code snipped to the ViewController.ViewDidLoad method.

base.ViewDidLoad();

var label = new NSTextView();
label.TranslatesAutoresizingMaskIntoConstraints = false;
this.View.AddSubview(label);
this.View.AddConstraint(NSLayoutConstraint.Create(
            label,
            NSLayoutAttribute.Leading,
            NSLayoutRelation.Equal,
            this.View,
            NSLayoutAttribute.Leading,
            1.0f,
            10));
this.View.AddConstraint(NSLayoutConstraint.Create(
            label,
            NSLayoutAttribute.Trailing,
            NSLayoutRelation.Equal,
            this.View,
            NSLayoutAttribute.Trailing,
            1.0f,
            10));
this.View.AddConstraint(NSLayoutConstraint.Create(
            label,
            NSLayoutAttribute.Top,
            NSLayoutRelation.Equal,
            this.View,
            NSLayoutAttribute.Top,
            1.0f,
            10));

this.View.AddConstraint(NSLayoutConstraint.Create(
            label,
            NSLayoutAttribute.Bottom,
            NSLayoutRelation.Equal,
            this.View,
            NSLayoutAttribute.Bottom,
            1.0f,
            10));
this.View.AddConstraint(NSLayoutConstraint.Create(
            label,
            NSLayoutAttribute.Bottom,
            NSLayoutRelation.Equal,
            this.View,
            NSLayoutAttribute.Bottom,
            1.0f,
            20));

The last two constraints obviously conflict and, when added to a fresh Xcode project, will generate debug output that looks similar to the first example. Is there a way to turn these messages on when debugging a Xamarin.Mac application from Visual Studio for Mac?

Greetings Julius

=== Visual Studio Community 2017 for Mac ===

Version 7.5.3 (build 7)
Installation UUID: 57fb200c-8ea4-4cf4-9b75-78a7e0eea435
Runtime:
Mono 5.10.1.57 (2017-12/ea8a24b1bbf) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)
Package version: 510010057

Best Answer

  • ChrisHamonsChrisHamons US Xamurai
    Accepted Answer

    So I don't see those messages, even when I run a sample from the command line directly, so it isn't standard out / error.

    However, if I open up the "Console" application and filter to my application I see them.

    It appears Xcode is adding the appkit logging in somehow itself (it isn't coming from the application directly).

    That is a cool feature though, so I've filed it here - https://github.com/xamarin/xamarin-macios/issues/4433

Answers

  • ChrisHamonsChrisHamons USXamarin Team Xamurai
    Accepted Answer

    So I don't see those messages, even when I run a sample from the command line directly, so it isn't standard out / error.

    However, if I open up the "Console" application and filter to my application I see them.

    It appears Xcode is adding the appkit logging in somehow itself (it isn't coming from the application directly).

    That is a cool feature though, so I've filed it here - https://github.com/xamarin/xamarin-macios/issues/4433

Sign In or Register to comment.