When writing code that reports errors to the user, usually when I get back an NSError result, I use the following code snippet to show it:
if (err != null){ NSAlert.WithError (err).BeginSheet (Window, delegate { // Any needed cleanup code can go here, // it is invoked when the Sheet goes away. }); return; }
The above creates an NSAlert object using the WithError factory method, and then invokes the BeginSheet method to present this modally to the user. Usually you can put any cleanup code in the body of the provided delegate.