Hi everyone,<div><br></div><div>I have run into a bug in what I think is the runtime that is causing me some real problems.</div><div><br></div><div>My app is document-based and I override the function GetAsData is order to save. </div>
<div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #b63c36">public</span> <span style="color: #b63c36">override</span> NSData GetAsData (<span style="color: #37996a">string</span> documentType, <span style="color: #b63c36">out</span> NSError outError)</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                        </span><span style="color: #b63c36">try</span> {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span><span style="color: #37996a">var</span> circuitDump = <span style="color: #ff41fe">&quot;&quot;</span>;</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span><span style="color: #b63c36">if</span> (Circuit != <span style="color: #b63c36">null</span>) {</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                        </span>circuitDump = Circuit.DumpCircuit ();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span><span style="color: #37996a">var</span> data = NSMutableData.Create ();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span>data.AppendBytes (System.Text.Encoding.UTF8.GetBytes (circuitDump));</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span>outError = NSError.FromDomain (NSError.OsStatusErrorDomain, <span style="color: #ff41fe">0</span>);</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span><span style="color: #b63c36">return</span> data;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                        </span>}  <span style="color: #b63c36">catch</span> (Exception ex) {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span>Log.Error (ex);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                                </span>outError = NSError.FromDomain (NSError.OsStatusErrorDomain, -<span style="color: #ff41fe">4</span>);</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #b63c36"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                                </span></span>return<span style="color: #000000"> </span>null<span style="color: #000000">;</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                        </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>}</p></div><div><br></div><div>This works great for the 1st save. But if I try to save the document for a second time (keep it open, and just hit &quot;Save&quot; a second time), I get the crash pasted at the end of this message.</div>
<div><br></div><div>This is the last bug preventing me from releasing this app and I would appreciate _any_ assistance anyone could provide. I am a bit desperate to get this thing shipped so would be willing to pay someone to diagnose and correct the error.</div>
<div><br></div><div>(My guess is that is has something to do with the &quot;outError&quot; parameter being handled incorrectly. But it&#39;s just a guess.)</div><div><br></div><div><br></div><div><div>Stacktrace:</div><div>
<br></div><div>  at (wrapper managed-to-native) MonoMac.ObjCRuntime.Messaging.intptr_objc_msgSend (intptr,intptr) &lt;0xffffffff&gt;</div><div>  at MonoMac.ObjCRuntime.Runtime.GetNSObject (intptr) &lt;0x000e5&gt;</div><div>
  at (wrapper dynamic-method) object.[Circuit.Mac.CircuitDocument.MonoMac.Foundation.NSData GetAsData(System.String, MonoMac.Foundation.NSError ByRef)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSString,intptr&amp;) &lt;0x00031&gt;</div>
<div>  at (wrapper native-to-managed) object.[Circuit.Mac.CircuitDocument.MonoMac.Foundation.NSData GetAsData(System.String, MonoMac.Foundation.NSError ByRef)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSString,intptr&amp;) &lt;0xffffffff&gt;</div>
<div>  at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) &lt;0xffffffff&gt;</div><div>  at MonoMac.AppKit.NSApplication.Main (string[]) &lt;0x00017&gt;</div><div>  at CircuitMac.MainClass.Main (string[]) &lt;0x00019&gt;</div>
<div>  at (wrapper runtime-invoke) &lt;Module&gt;.runtime_invoke_void_object (object,intptr,intptr,intptr) &lt;0xffffffff&gt;</div><div><br></div><div>Native stacktrace:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>0   iCircuit                            0x000b7009 0x0 + 749577</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>1   iCircuit                            0x0000704e 0x0 + 28750</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>2   libSystem.B.dylib                   0x98d7945b _sigtramp + 43</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>3   ???                                 0xffffffff 0x0 + 4294967295</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>4   ???                                 0x13662c96 0x0 + 325463190</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>5   ???                                 0x012e6e5a 0x0 + 19820122</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>6   ???                                 0x017f8a74 0x0 + 25135732</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>7   AppKit                              0x9166c419 -[NSDocument writeToURL:ofType:error:] + 865</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>8   AppKit                              0x9166832d -[NSDocument writeToURL:ofType:forSaveOperation:originalContentsURL:error:] + 482</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>9   AppKit                              0x9166c71b -[NSDocument _writeSafelyToURL:ofType:forSaveOperation:error:] + 271</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>10  AppKit                              0x9166b916 -[NSDocument writeSafelyToURL:ofType:forSaveOperation:error:] + 422</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>11  AppKit                              0x91666856 -[NSDocument saveToURL:ofType:forSaveOperation:error:] + 201</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>12  AppKit                              0x91669a95 -[NSDocument _saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] + 71</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>13  AppKit                              0x91666ba4 -[NSDocument saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] + 788</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>14  AppKit                              0x9166b38d -[NSDocument _saveDocumentWithDelegate:didSaveSelector:contextInfo:] + 879</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>15  AppKit                              0x91666f59 -[NSDocument saveDocumentWithDelegate:didSaveSelector:contextInfo:] + 354</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>16  AppKit                              0x9166702b -[NSDocument saveDocument:] + 58</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>17  AppKit                              0x9134ac46 -[NSApplication sendAction:to:from:] + 112</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>18  AppKit                              0x9134aaf9 -[NSMenuItem _corePerformAction] + 435</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>19  AppKit                              0x9134a7eb -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 174</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>20  AppKit                              0x91446403 -[NSMenu _performActionWithHighlightingForItemAtIndex:] + 49</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>21  AppKit                              0x91445baf -[NSMenu performKeyEquivalent:] + 314</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>22  AppKit                              0x91444353 -[NSApplication _handleKeyEquivalent:] + 581</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>23  AppKit                              0x9133a1f2 -[NSApplication sendEvent:] + 4858</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>24  AppKit                              0x912ce2a7 -[NSApplication run] + 917</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>25  AppKit                              0x912c62d9 NSApplicationMain + 574</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>26  ???                                 0x027c66da 0x0 + 41707226</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>27  ???                                 0x027c6620 0x0 + 41707040</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>28  ???                                 0x003d4da2 0x0 + 4017570</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>29  ???                                 0x003d4e35 0x0 + 4017717</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>30  iCircuit                            0x000114e4 0x0 + 70884</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>31  iCircuit                            0x001bcca6 0x0 + 1821862</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>32  iCircuit                            0x001bf2a1 0x0 + 1831585</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>33  iCircuit                            0x001be68b 0x0 + 1828491</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>34  iCircuit                            0x00088662 0x0 + 558690</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>35  iCircuit                            0x00003ca6 0x0 + 15526</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>36  ???                                 0x00000001 0x0 + 1</div>
<div><br></div><div>Debug info from gdb:</div><div><br></div><div>/tmp/mono-gdb-commands.y62M4K:1: Error in sourced command file:</div><div>unable to debug self</div><div><br></div><div>=================================================================</div>
<div>Got a SIGSEGV while executing native code. This usually indicates</div><div>a fatal error in the mono runtime or one of the native libraries </div><div>used by your application.</div><div>=================================================================</div>
<div><br></div><div><br></div></div><div><br></div><div><br></div>