Forum Xamarin Xamarin.iOS

Boilerplate style declaration "| NSWindowStyle.Titled" throws

CaptainXamtasticCaptainXamtastic GBUniversity ✭✭✭

Hi,

The following boilerplate code throws:

var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled;

however if I do this:

var style = NSWindowStyle.Closable | NSWindowStyle.Resizable;// | NSWindowStyle.Titled;

the MacOS Xamarin Forms app kicks up, albeit without the title bar.

Any ideas?

The error is:

Object reference not set to an instance of an object

and the stacktrace is:

" at Xamarin.Forms.Platform.MacOS.NativeToolbarTracker.UpdateTitle () [0x00125] in :0 \n at Xamarin.Forms.Platform.MacOS.NativeToolbarTracker.UpdateToolBar () [0x0011b] in :0 \n at Xamarin.Forms.Platform.MacOS.NativeToolbarTracker.set_Navigation (Xamarin.Forms.NavigationPage value) [0x0008d] in :0 \n at Xamarin.Forms.Platform.MacOS.NavigationPageRenderer.Init () [0x00025] in :0 \n at Xamarin.Forms.Platform.MacOS.NavigationPageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0000e] in :0 \n at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in :0 \n at Xamarin.Forms.Platform.MacOS.MasterDetailPageRenderer.UpdateControllers () [0x00066] in :0 \n at Xamarin.Forms.Platform.MacOS.MasterDetailPageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0000e] in :0 \n at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in :0 \n at Xamarin.Forms.Platform.MacOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x00027] in :0 \n at Xamarin.Forms.Platform.MacOS.Platform.WillAppear () [0x0001c] in :0 \n at Xamarin.Forms.Platform.MacOS.PlatformRenderer.ViewWillAppear () [0x00006] in

(etc)

Any ideas?

Kind regards,

Anthony

Best Answer

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    I can't reproduce this error , could you provide a basic reproduction sample to us?

  • CaptainXamtasticCaptainXamtastic GBUniversity ✭✭✭

    @ColeX said:
    I can't reproduce this error , could you provide a basic reproduction sample to us?

    Hi @ColeX ,

    Thanks so much, the demo app is attached (I've copied it from the original project and sanitised it).

    (Please be aware that clicking on the information icon doesn't work (the RelayCommand doesn't fire), despite it working in iOS - when invoked on iOS it kicks up a modal page).

    But the task in hand is the | NSWindowStyle.Titled throwing ... I've left it uncommented so it will throw when started.

    Kind regards,

    Anthony

    My Visual Studio settings are as follows:

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

    Version 7.6.10 (build 27)
    Installation UUID: 8ce29ded-598c-460c-935b-d4823d293212
    Runtime:
    Mono 5.12.0.309 (2018-02/39d89a335c8) (64-bit)
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

    Package version: 512000309
    

    === NuGet ===

    Version: 4.3.1.4445

    === .NET Core ===

    Runtime: /usr/local/share/dotnet/dotnet
    Runtime Versions:
    2.1.2
    2.1.1
    2.0.5
    2.0.0
    1.1.2
    1.0.5
    SDK: /usr/local/share/dotnet/sdk/2.1.302/Sdks
    SDK Versions:
    2.1.302
    2.1.301
    2.1.4
    2.0.0
    1.0.4
    MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

    === Xamarin.Profiler ===

    Version: 1.6.3
    Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

    === Xamarin.Android ===

    Version: 9.0.0.20 (Visual Studio Community)
    Android SDK: /Users/BathSpaCentral/Library/Android/sdk
    Supported Android versions:
    2.3 (API level 10)
    5.0 (API level 21)
    5.1 (API level 22)
    6.0 (API level 23)
    7.0 (API level 24)
    7.1 (API level 25)
    8.0 (API level 26)
    8.1 (API level 27)

    SDK Tools Version: 26.1.1
    SDK Platform Tools Version: 28.0.0
    SDK Build Tools Version: 25.0.3

    Java SDK: /usr
    java version "1.8.0_131"
    Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
    Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

    Android Designer EPL code available here:
    https://github.com/xamarin/AndroidDesigner.EPL

    === Apple Developer Tools ===

    Xcode 10.1 (14460.46)
    Build 10B61

    === Xamarin.Mac ===

    Version: 5.0.0.0 (Visual Studio Community)
    Hash: b40230c0
    Branch:
    Build date: 2018-09-27 11:41:37-0400

    === Xamarin.iOS ===

    Version: 12.0.0.15 (Visual Studio Community)
    Hash: 84552a46
    Branch: xcode10
    Build date: 2018-09-17 21:54:33-0400

    === Xamarin Inspector ===

    Version: 1.4.3
    Hash: db27525
    Branch: 1.4-release
    Build date: Mon, 09 Jul 2018 21:20:18 GMT
    Client compatibility: 1

    === Build Information ===

    Release ID: 706100027
    Git revision: 94dbd4d35daaa5a2ff6a51c3fd5cbb2308bd83ea
    Build date: 2018-10-18 16:34:31+00
    Build branch: release-7.6
    Xamarin extensions: 3a9afc960ba73e5862829e8a0cd9369bcca43d70

    === Operating System ===

    Mac OS X 10.14.0
    Darwin 18.0.0 Darwin Kernel Version 18.0.0
    Wed Aug 22 20:13:40 PDT 2018
    root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64

    === Enabled user installed extensions ===

    NuGet Package Management Extensions 0.12.6

  • CaptainXamtasticCaptainXamtastic GBUniversity ✭✭✭

    @ColeX said:
    It's weird , it works fine with or without NSWindowStyle.Titled.

    I checked the version , it's almost the same except the operating system , my mac is 10.13.6 , High Sierra.

    @ColeX Thanks so much, I've raised a bug report on Xamarin's MacOS Bugzilla so that someone can either resolve it - or deduce that it is Mac OS Mojave problem.

    It's here:

    https://github.com/xamarin/xamarin-macios/issues/5079

    Kind regards,

    Anthony

Sign In or Register to comment.