Bug 45340 - SCNView as final element in block (i.e., that which is rendered) throws NRE and breaks agent connection
Summary: SCNView as final element in block (i.e., that which is rendered) throws NRE a...
Status: VERIFIED FIXED
Alias: None
Product: Workbooks & Inspector
Classification: Xamarin
Component: Agent: iOS ()
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: 1.0
Assignee: Aaron Bockover [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2016-10-12 19:59 UTC by Larry O'Brien
Modified: 2017-02-16 15:10 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Screenshot showing behavior (204.27 KB, image/png)
2016-10-12 19:59 UTC, Larry O'Brien
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Larry O'Brien 2016-10-12 19:59:11 UTC
Created attachment 18010 [details]
Screenshot showing behavior

If the final element in a code cell is a SceneKit `SCNView` then the rendering attempt throws a NullReferenceException and further evaluations lead to "error: Cannot execute: not connected to agent."

Workaround: ensure that the final element in a code cell is not a `SCNView`. 

To reproduce:

Create a new iOS workbook.

```
using SceneKit;
var vw = new SCNView(KeyWindow.Bounds);
true; //Dummy final element
```

Evaluate the above and the renderer will render 'true'. (The problem is not the creation of the `SCNView` per se.) 

Delete the `true` and re-evaluate:

```
using SceneKit;
var vw = new SCNView(KeyWindow.Bounds);
```
Comment 2 Rajneesh Kumar 2016-11-08 17:58:00 UTC
I have checked this issue with XamarinInteractive-0.99.0.0 and I observed that now workbook session gets disconnected and shows following error:

=> The application terminated during execution of this cell. Run this cell manually to try again.

Screencast: http://www.screencast.com/t/WXvOm6vFq

Thanks..!
Comment 3 Aaron Bockover [MSFT] 2016-11-08 20:33:04 UTC
This bug exemplifies why we have stressed agent reconnection so much since the 0.10 release. The behavior shown in comment #2 is actually correct.

The disconnect happens because the member reflection we perform invokes native code that is crashing the workbook application. Reconnecting allows for the workbook to become usable again, and the error message in the cell in question indicates that the cell caused the workbook to crash (thus the user should know to do something different). So this demonstrates our resiliency to crashing workbooks.

Beyond that, all we can do is avoid calling into known buggy/crashy APIs.

I have added skip rules for the two offending SCNView properties: AudioEnvironmentNode and AudioListener, so you can now see SCNView as a result.