After lots of web searches and trying different things, I was able to get things working in the latest MonoDevelop. There are actually two separate issues here. The first affects OSX 10.6 and later in my testing (no access to 10.5). The second affects OSX 10.7 and later.
Many silverlight websites will crash in a webView even in OSX 10.6. You can fix the crash by changing the useragent as so
webBrowser.CustomUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2";
It is hard to believe that this fixed things, but it did, even though the useragent string without this is very similar:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.57.2 (KHTML, like Gecko)
Even with this fix, the latest MonoDevelop webView + Silverlight on OSX 10.7 or later = crash. Why? It appears that the silverlight plugin has issues with the heap execution security stuff in 10.7 and later. MonoDevelop 2.8.8.4 did not set the flag on the unix executable to prevent heap execution, but the latest MonoDevelop does. From MonoDevelop, I don't know if you can get to a place where you change the parameters passed to ld to do -allow_heap_execute. But you can modify the flag yourself in the unix executable in the appbundle with a hex editor...
I grabbed HexFiend and then put it in my applications folder. Show the contents of your output app bundle (via right click) and then dig into Contents/MacOS/ . There will be one file there. Open it in HexFiend. You will see bytes like this:
CEFAEDFE 07000000 03000000 02000000 13000000 3C080000 85002001
See that last 1? That is the no heap execution flag. Turn it off by changing the 1 to a 0. This got my webView that shows pages with Silverlight to run without a hitch on OSX 10.8
I ended up writing a little mono console app that I call as a post build step to do this for me. It is invoked as
mono "<path-to-console-app-exe>" "<path-to-mac.app-package>"
Here is the main function:
public static void Main (string[] args)
{
if (args.Length > 0)
{
if (Directory.Exists(args[0]))
{
string containingFolder = Path.Combine (Path.Combine(args[0], "Contents"), "MacOS");
var files = Directory.GetFiles (containingFolder);
if (files.Length == 1)
{
var bytes = File.ReadAllBytes(files[0]);
byte one = (byte)1;
byte allButOne = (byte)~one;
bytes[27] = (byte)(bytes[27] & allButOne);
File.WriteAllBytes(files[0], bytes);
return;
}
}
}
throw new InvalidOperationException("Failed to allow heap execution");
}
For what it's worth, Silverlight on Mac seems to be a very brittle proposition. I don't really have a short-term choice about it, and you may not either, but figuring this out led me through all kinds of search results of people having various problems with Silverlight and updated versions of OSX.
Here are the links that helped me along to my answers:
Firefox crash with silverlight and same stack where on fix considered was turning off the heap protection stuff
Linked firefox crash where problem was resolved by running silverlight plugin out of process where heap execution is allowed
Apple resource on the flags in the header
Chromium bug that actually lists what flag is the heap execute one - not in apple's docs - awesome!
Bug 1 filed on Connect about the crash fixed by changing the user agent string
Bug 2 filed on Connect about the crash fixed by changing the user agent string