Eto: Mac - Mono 6.4 runs all apps, higher Mono versions do not

Created on 28 Mar 2020  ·  21Comments  ·  Source: picoe/Eto

All Mac apps I have developed so far have stopped working after upgrading Mono to 6.6 (same problem with 6.8).

Reverting to a previous installation of Mono 6.4 fixes the problem.

My apps compile against TargetFramework net461 (Mac entry point) and netstandard2.0 (shared dll) in case it matters.

As always, the error is likely to be mine.

Thank you for your patience.

All 21 comments

Hey @LaraSQP, thanks for the reports, but it would really help if you included details like the actual exception (check Console.app) and what you have tried.

Also, one thing to note is that when compiling for _release_, with mono installed on your dev box, it will bundle mono within your app so it won't require mono to be installed to _run_ your app. This will make it so that you have a known runtime. Alternatively, use .NET Core instead and bundle it in your app (does not require mono to be installed to do so).

Thank you for the quick reply.

Did not know about Console.app and will report the exception.

Did not know either about installing Mono on Windows. Darn thing. Which installer applies? 64-bit (no GTK#) or do I need the GTK# too?

GTK# is not needed, it only uses mkbundle for bundling mono, which it does using the <MacBundleTarget> property in your csproj. It defaults to mono-6.4.0-osx-10.9-x64 if not specified, and can be any value listed in mkbundle -list-targets

Regarding Console.app I only have two errors that are quite uninformative (to me, at least):

Mar 29 06:19:01 my-MacBook-Air com.apple.xpc.launchd[1] (com.apple.xpc.launchd.oneshot.0x1000015e.MyApp1[10705]): Service exited with abnormal code: 78

Mar 29 06:40:29 my-MacBook-Air com.apple.xpc.launchd[1] (com.example.MyApp1.4212[11362]): Service exited with abnormal code: 1

Trying now to recompile with Mono installed.

@LaraSQP Take a look at the "Crash Reports" section. It should have an entry for when your app crashed. A copy of that helps diagnose issues.

"Crash Reports" is empty.

BTW, I have mono 6.8 installed and am not seeing the same issue..

Screen Shot 2020-03-28 at 3 30 34 PM

One thing to consider, is that if you did modify Info.plist in some fashion (from one of your other issues), is that it _needs_ to be LF only, UTF-8 _without BOM_, and not CRLF. It will assume it is corrupted otherwise.

Info.plist had been changed by npp.

I have installed Mono on my dev machine but recompilation does not add Mono to the bundle. What am I missing?

In Release mode it does it by default. Otherwise, set <MacBundleMono> to true in csproj.

Take a look at BundleMono.targets and Mac.targets for the various properties you can set.

I hope to add these options to the VS project properties to make it easier in the future to discover them, but alas so little (free) time to do so.

Adding <MacBundleMono>True</MacBundleMono> to csproj does not do it.

Unless it does it in a way that is not apparent to me, that is.

OK.

It turns out that a MonoBundle folder is included in the app only when MacBundleMono is set to False.

Also, Info.plist is changed by the build process to include both UTF-8 BOM and CRLF, so they must be fixed manually afterwards.

Also, Info.plist is changed by the build process to include both UTF-8 BOM and CRLF, so they must be fixed manually afterwards.

This should not be the case.. could you attach your Info.plist file that you are using (not the compiled one).

It turns out that a MonoBundle folder is included in the app only when MacBundleMono is set to False.

Yes, a MonoBundle folder does not mean that mono is bundled.. oddly.. the absence of this folder means that mono is 'bundled' and everything is included in the native executable.

MacBundleMono is a bust. Mono is not included no matter what.

And any version of Mono above 6.4.0.137 continues to crash my apps.

I'll look into the build targets later.

Thank you for your patience.

Are you still getting this warning when building?

Couldn't find mkbundle, so app bundle will require mono to be installed! Install mono from https://mono-project.com to bundle it with your app or set MonoPath to where it is installed.

If so, you may need to restart or point specifically to where mono was installed using <MonoPath>.

Also could you send me the dmg of your app (assuming you are willing to do that?). I could try to diagnose it further.

I am not getting a warning about mkbundle so I'll try the MonoPath next.

Attached is a simple project that I have used to test this and that. It does not even start above Mono 6.4 in Mac and there is no crash report in Console.app

MacFileTest.zip

I had added Mono to the environment variables, so mkbundle is accessible no problem. MonoPath is not the issue here.

In fact, I was able to run mkbundle manually via...

mkbundle --simple --cross mono-6.4.0-osx-10.9-x64 MacFileTest.exe -o MacFileTest

... which seemed to succeed except that it won't run on Mac.

Since there is no reference to mkbundle in my project (above), it is evident I am missing a whole lot.

It seems my last post did not make it, or I cannot find it, or it was somehow deleted.

First, using netcoreapp3.1 indeed fixed the problem. Thank you so much.

I uninstalled Mono and all apps now run on net core. I am a bit surprised since the command dotnet in the Terminal burps:

zsh: command not found: dotnet

Guess one thing does not have to do with the other (?).

There remain two small issues that you might want to know about:

  1. The build process always includes a .pdb file inside the MacOS folder of the bundle.

  2. The build process always modifies Info.plist to include a CFBundleExecutable key, duplicating the existing one if present. This results in both BOM and CRLF to be included despite not being present in the original Info.plist in the project.

The workaround both these problems is a simple batch file to delete 1 and replace 2, that unfortunately must be run manually since it cannot be added to the post-build events for despite being post-build it still runs too early, as far as I can tell.

Thanks again for your infinite patience.

Was this page helpful?
0 / 5 - 0 ratings