Created attachment 24224 [details]
After upgrading VSmac to 22.214.171.1247 (the version bundled with Xamarin 15.3), when opening a storyboard I get:
- a popup that says "MonoTouchDesignServerUnified quit unexpectedly"
- a banner is shown in the designer, which says "Custom components are not being rendered because problems were detected"
This happens every time. Clicking the "try again" button repeats the error, as well as opening other storyboards.
Created attachment 24225 [details]
Can you attach the log files generated from the session where the error occurred? You can find the logs by clicking Help -> Open Log Directory. If you delete everything there, then reproduce the problem, then attach the full set of log files (there'll be 4 or 5 files) that would be great!
Created attachment 24226 [details]
I got the same issue, Here are my logs from the designer (my other logs are empty)
Created attachment 24227 [details]
These are my log files.
I don't know if it's related or not, but I see a NullReferenceException invoking my code in the code-behind. Why does the designer try to call that code? It will obviously not work because other app-level things need to be initialised.
Created attachment 24230 [details]
So, as an experiment, I've changed my code to avoid that NullReferenceException and it helps. I don't get the popup anymore, although one view controller in the storyboard is all red (doesn't load correctly).
However, I've tried another storyboard and I get again that popup. The log shows a different problem now (SIGSEGV). Please see attachment.
This is a known issue we addressed several weeks ago but could not include the fix in the final 15.3 release.
The workaround for what you're experiencing is to open the storyboard file as text and remove the `device` element from the top of the storyboard. It typically looks something like:
<device id="retina4_0" orientation="portrait">
If you have further issues can you file a new bug report so we can use this report to deal exclusively with Marco's issue. Thanks!
In the first set of logs we can see that your code threw an exception asynchronously when iOS invoked the ViewDidAppear method. We can apply a further mitigation which should prevent the crash dialog from appearing in cases like this. However as the exception is asynchronous we have no easy way to capture it and propagate that information back to the IDE.
That said, the second set of logs is very interesting. It looks like an a native crash is occurring when invoking standard iOS functions, which is bizarre. It's possible this is related to a custom control too as the issue looks like it went away when the designer automatically disabled custom control support. Would you be able to privately share a copy of your project so we can reproduce and diagnose the issue locally?
A direct email to me would be fine, or we can create a new private bug in bugzilla so you can attach it there. Let me know which option is preferable if you are able to share it.
Regarding the first problem, I'm not sure why you say it's an "asynchronous" exception, to me it looks a normal exception thrown while executing the call to ViewDidDisappear. Anyway, my question is: why does the designer run that method at all?
Also, as far as I can tell, this didn't happen in previous versions of XS/VS and wouldn't happen in Interface Builder if coding the app in ObjC/Swift.
Regarding the second problem, I can't share the full project but I'll try to make you a test project with just the Storyboard, so you can reproduce.
iOS itself is invoking this method some time after the view is made visible. The designer itself is not involved in this particular method invocation, which is why we cannot catch it and report it like we can for exceptions thrown inside `LoadView` or inside constructors.
> at EviApp.DataLogRecordNewViewController.StopLogging () [0x0000d] in /Users/marco/Desktop/EviApp_dashboard/EviApp-ios/UI/DataLogRecordNewViewController.cs:180
> at EviApp.DataLogRecordNewViewController.ViewDidDisappear (System.Boolean animated) [0x0000f] in /Users/marco/Desktop/EviApp_dashboard/EviApp-ios/UI/DataLogRecordNewViewController.cs:79
> at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string,intptr,intptr)
It would also happen in Xcode if you had written a custom control which Xcode was able to load ( https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/ImplementingACustomControl.html ).
If the iOS designer disabled custom control loading then the issue would also not occur, but things would not render as accurately.
If it will help anyone, we hit this problem this morning as well after an update to 15.3. We tried removing the <device> node but that made no difference. What did make a difference, however, was simply re-cloning the project from Github to get an "unbuilt" version of the project and then cleaning and rebuilding that.
My assumption from our logs is that the problem existed somewhere in the designer files and the clean/rebuild from a fresh project fixed that.
I experience the same problem.
It is very frustrating and makes "normal" work almost impossible.
Sometimes the designer crashes and sometimes a restart let's me continue to work.
Another possible related issues is that the loading of the storyboard is extremely slow. I took a look at the log files, but they are so big and don't make much sense to me. Besides that, I think resolving this issue is a case for Microsoft/Xamarin and I should concentrate on my own work: building apps efficiently using Visual Studio instead of trying to find the root cause of a designer crash.
Happens with this storyboard
No custom components.
Kraig, Bert, Doug: if you are experiencing issues could you attach the log files from a session where you triggered the error?
So far the only confirmed issue is the mis-handling of the `device` element in the xml which has been addressed.
Secondly, we do have a mitigation in place to ensure the macOS crash report dialog doesn't appear when the rendering processes encounters an error. This mitigation did not work in all cases, but we've enhanced that so it works in more cases. That will ship in a future release.
However the underlying cause of the issue could simply be user-code throwing asynchronous exceptions like I described in comment 8.
@Alan, I had sent you an email on Aug 16th but never got a reply, so maybe it was flagged as spam?
Here's the email:
I've tried to create a project which replicates a segfault but haven't managed to.
I've successfully created one that replicates the exception in ViewDidDisappear though. Since I had to copy all the storyboards, if you need the project, I need to ask permission to my manager first.
Now, what I can say is that after working around that NullReferenceException, I'm getting all sorts of segfaults and other errors in many storyboards.
Please see the attached logs and screenshots.
I feel like something's wrong here, I wonder if there's some memory corruption or threading issue.
Going back to the exception on ViewDidDisappear, please let me point out a few things.
I agree that a Custom View needs its code executed to render properly. Views are independent building blocks used in the UI and can be instantiated independently from the rest of the app, so there's no problem with that.
View Controllers, however, are the glue between the Views and the business logic. They will almost always need other things in the app to have already been setup (ie. a "login" view-controller might want to prepopulate the username in a textbox and that username must have already been loaded along with other settings from an XML file when the app is launched).
I understand you're not invoking ViewDidDisappear in your code, but even iOS/UIKit/xxx shouldn't be calling it either, unless the view controller is actually being presented.
Other things that make me think something iffy is going on:
- if I create a brand new iOS single-page project in VSmac and add exceptions to ViewWillAppear/ViewWillDisappear, it does NOT cause any problems in the iOS Designer, so they don't get called
- in my project the ViewDidDisappear method gets called regardless if the storyboard I'm trying to open contains that view controller or not
Please let me know if you want that storyboards-only project to investigate.
I'm attaching Logs and screenshots privately.
Uhm... apparently I can't add private comments/attachments, so please let me know how to pass them to you if you can't find the email.
Fixed in version 126.96.36.1993 (d15-4)
Author: Alan McGovern
Commit: bc1ccf4001b185bc517287e6d378d66d56c18c40 (xamarin/md-addins)
Included in Commit: 861d3eb8f64655762b85235dde49874645208f51 (mono/monodevelop)
Sorry - that was our bug auto-closer being a little pro-active as we landed a workaround for one aspect of this.
The simplest way to attach a private comment/attachment would be to create a new bug report and click the `Xamarin Team (Private Bug)` checkbox before submitting it. You'll be free to attach private things to the report then.
I did find your email - it had been flagged as potential spam alright. I reviewed the log files and it looks like there's a crash occuring within iOS itself. To diagnose that we would need a testcase which reproduces the issue. I don't know if your storyboard alone would be sufficient for that, or if a full compilable copy of the project would be needed. You could check if the storyboard file alone is enough by adding it to a new project and seeing if you can trigger the same failure case.
The interesting part of the log are the places where you see this string `critical: Stacktrace` and also `Native stacktrace:`. It's possible this is fallout from another error, but unfortunately nothing shows up in the logs.
I've just double-checked and the storyboard-only project will only reproduce the issue with Exceptions thrown in ViewDidDisappear() and similar. There are no other sorts of crashes.
Unfortunately, I can't share the full project.
Until this issue is fixed I can't upgrade VSmac and today I've discovered 7.0 won't work with Xcode 9, so I can't upgrade that either.
Is there any way to prepare a test case with precompiled source plus the storyboard files?
If you want to supply a pre-compiled test case I believe this should work:
0) Create a copy of your project locally so you can safely delete files without affecting your actual work.
1) Compile the project.
2) Delete the `.git` directory (or whatever metadata your version control system might store inside your checkout).
3) Delete all the .cs files from the directory.
4) Delete any other files which are proprietary/secret.
5) Zip up the directory structure.
Now unzip that file to another location, open the sln/csporj in the IDE and attempt to reproduce the problem. If you can still reproduce the issue then we should also be able to reproduce it using the same zip file. That should be all we need to diagnose/fix the issue. The zip is likely to be quite large but there's no easy way to trim down the binaries without increasing the chance of masking/hiding the root of the problem.
This is not a private bug so it'd be best to send the attachment directly.
That worked! I've also removed the other projects to keep the ZIP a bit smaller. Still quite big but manageable.
I've sent you a download link via email.
Alan, I've sent you a 2nd test project and another email but got no reply so I think they might have been marked as spam like it happened before. Could you kindly confirm you've received those emails?
we are suffering from the same issue after upgrading to Visual Studio Community 2017 for Mac Version 7.2 (build 636).
When I clean the solution, I dont get any error. I took a look to the logs file attahced by @marco and @denis and it seems like the root cause for us is different, however I did not want to file anotrher one since we get the same error. The log file is attached.
Created attachment 25274 [details]