Forum Xamarin.Mac

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Mac app opens storyboard window despite lacking Entry Point / Initial Controller

kiberklikiberkli Member ✭✭

Hi Everyone,

My app automatically opens a window when launched, it's the original window from the Xamarin template. However the window depends on data that isn't available this early in the launch process.
There is no Storyboard Entry point set (Is Initial Controller isn't set anywhere). Yet the main window is open before AppDelegate.DidFinishLaunching() runs.

I expected to have to set an storyboard entry point before any windows become visible. I can open the window manually. In fact if I do that I get two of the same window.

What is the magic that opens this window despite lacking the entry point very early in the launch process?

Thank you in advance.

kib

Best Answers

  • kiberklikiberkli Member ✭✭
    Accepted Answer

    This looks like the solution:

    • Delete CFBundleDocumentTypes form Info.plist - Not sure if that's really necessary.
    • Exclude from the project and delete the Document.cs file. Excluding it from the project wasn't enough.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    How did you set the root window?
    Did you configure a window outside the storyboard using code behind?
    Could you please reproduce this on a small sample?
    We need it to do more investigation.

  • kiberklikiberkli Member ✭✭

    I didn't do anything special other than use, and add to the storyboard the app template created.
    I tried to see if a new solution/project from a template would reproduce the problem but it did not. The new app appears to function as it should with an initial controller.

    I'll post more details if I see any.

  • LandLuLandLu Member, Xamarin Team Xamurai

    Yeah, we also need the sample to help us reproduce this issue.
    If your project can't be posted on this public forum, try to open a free support ticket here:
    https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6
    You will get one-to-one support there and Microsoft promises to protect your personal sensitive information.

  • kiberklikiberkli Member ✭✭

    I think it may have something to do with Document.cs. I think it's opening a blank document window.

  • kiberklikiberkli Member ✭✭

    I've attached a project that behaves like what I'm seeing. I think it does this because it's a document-based app. I'm now trying to make my application a not-document-based app.

  • kiberklikiberkli Member ✭✭
    Accepted Answer

    This looks like the solution:

    • Delete CFBundleDocumentTypes form Info.plist - Not sure if that's really necessary.
    • Exclude from the project and delete the Document.cs file. Excluding it from the project wasn't enough.
  • LandLuLandLu Member, Xamarin Team Xamurai

    Do you mean this issue is solved by performing these steps?

  • kiberklikiberkli Member ✭✭

    No, those steps make your project a non document-based app. A document-based app will programatically open a document window at launch without an initial controller.
    So what I was seeing was 'by design'. I should not have created a document-based application.

  • kiberklikiberkli Member ✭✭
    edited June 2020

    Yes, that also seems to work.

    Thanks for all your help.

Sign In or Register to comment.