Forum Xamarin.iOS

Can't open Storyboard with ios designer in visual studio for mac?.

NaboNabo SEMember ✭✭
edited April 9 in Xamarin.iOS

Since today I can't open the storyboard file in the ios designer in xamarin. I can open it fine in xcode interface builder but there i have other issues not being able to add the IBOutlets anymore. So the last few months the process has been to design the UI in xcode with layout constraints etc. and then switch to ios designer to name controls to get access to them in code. Was working fine at least up till in the beginning of the week, but today I can't open the storyboard file in xamarin anymore. Also the log file referenced in the end of the below error message doesn't exist on disk.

System.NullReferenceException: Object reference not set to an instance of an object
at MonoTouch.Design.ProxiedView.get_UseSafeArea () [0x00001] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Shared/ProxiedView.cs:939
at MonoTouch.Design.ProxiedView.set_UseSafeArea (System.Boolean value) [0x00001] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Shared/ProxiedView.cs:944
at MonoTouch.Design.ProxiedViewController.UpdateLayoutGuides (MonoTouch.Design.Catalog utilityCatalog, MonoTouch.Design.IosDocument rootModel) [0x002c0] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Shared/ProxiedViewController.cs:243
at MonoTouch.Design.Storyboard.UpdateLayoutGuides (MonoTouch.Design.Catalog utilityCatalog) [0x00017] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Shared/Storyboard.cs:132
at MonoTouch.Design.Client.IPhoneDesignerSession.LoadXml (System.Func`1[TResult] getDoc, System.Boolean shouldTryUpgrade, System.String fileName) [0x00310] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Client/IPhoneDesignerSession.cs:477

Contents of /Users//Library/Logs/VisualStudio/8.0/iOSDesigner.2020-04-09__10-41-19.log:
Commit: 35aa4889dab48fb3471f20131d6f68dae41bc11c

[2020-04-09 10:49:44.6] INFO: IPhoneDesignerSdkManager: Initializing the designer service

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    Checking in the UI Designer, you will find that under the Toolbox, the ViewController is also showing as a custom component , so ViewController‘s ViewDidLoad method is getting call during design time , the error may comes from the code that is dependency injection which is not available during design time in ViewDidLoad method ,

    Try to add DesignTimeVisible on Viewcontroller attribute and set the flag to false , then clean and rebuild.

    [System.ComponentModel.DesignTimeVisible(false)]
    public partial class ViewController : UIViewController
    
  • NaboNabo SEMember ✭✭

    I don't really understand your reply as I'm unable to open the IOS designer and also I tried to add the attribute to all new controllers without success.

    I did find a workaround although quite messy. I noticed that my newest controllers had the " '' tag which was missing on some of the others, so I manually removed if using the source code editor. This makes me able to open the storyboard again in the ios designer. How ever the actual viewcontroller is there according to the documents outline but I don't see it in the ios designer. I then have to open the file in xcode interface designer where I can see the viewcontroller but the controls on it has to be realigned to the auto layout,

    Hope this helps someone else!

Sign In or Register to comment.