xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.43k stars 507 forks source link

"MM0000: Unexpected error" when an invalid character is used in the Assembly Name: "Hello, Mac" #5552

Open bvanrijn opened 5 years ago

bvanrijn commented 5 years ago

Steps to Reproduce

  1. Attempt to follow https://docs.microsoft.com/en-us/xamarin/mac/get-started/hello-mac
  2. Try to build the resulting project.

Expected Behavior

The app builds without any errors and then running the app works as well.

Actual Behavior

Building the app fails with:

/Users/barend/Developer/CSharp/HelloMac/MMP: Error MM0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com (MM0000) (HelloMac)

I found https://bugzilla.xamarin.com/show_bug.cgi?id=44697, which says:

That exception means we crashed inside mmp, which is never acceptable. With more information, we can get to the bottom of this.

Environment

=== Visual Studio Community 2017 for Mac ===

Version 7.7.3 (build 43)
Installation UUID: b6234557-4456-4ad3-921b-4651e11e2481
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

    Package version: 518000248

=== Mono Framework MDK ===

Runtime:
    Mono 5.18.0.248 (2018-08/a4956c837e1) (64-bit)
    Package version: 518000248

=== NuGet ===

Version: 4.8.0.5385

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.2.1
SDK: /usr/local/share/dotnet/sdk/2.2.103/Sdks
SDK Version: 2.2.103
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 10.1 (14460.46)
Build 10B61

=== Xamarin.Mac ===

Version: 5.2.1.13 (Visual Studio Community)
Hash: a4332c90
Branch: 
Build date: 2019-01-11 13:08:10-0500

=== Xamarin.iOS ===

Version: 12.2.1.13 (Visual Studio Community)
Hash: a4332c90
Branch: d15-9
Build date: 2019-01-11 13:08:09-0500

=== Xamarin.Android ===

Not Installed

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/barend/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.9
openjdk version "1.8.0-9"
OpenJDK Runtime Environment (build 1.8.0-9-microsoft-b00)
OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android Device Manager ===

Version: 7.7.1.0
Hash: 06ceaea1

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 707030043
Git revision: 5896ab2acba037c62271742e9e56b900c96c1d8f
Build date: 2019-01-15 21:18:33+00
Build branch: release-7.7
Xamarin extensions: e5b43ba963b7b407aa5b9f2c59018c32a709e6ab

=== Operating System ===

Mac OS X 10.14.3
Darwin 18.2.0 Darwin Kernel Version 18.2.0
    Thu Dec 20 20:46:53 PST 2018
    root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64

Build Logs


Building HelloMac (Debug)
Build started 5-2-2019 15:35:41.
__________________________________________________
Project "/Users/barend/Developer/CSharp/HelloMac/HelloMac.csproj" (Build target(s)):

Target _BeforeCoreCompileImageAssets:
    Directory "obj/Debug/actool" doesn't exist. Skipping.
Target _CoreCompileImageAssets:
    Tool /Applications/Xcode.app/Contents/Developer/usr/bin/actool execution started with arguments: --errors --warnings --notices --output-format xml1 --output-partial-info-plist /Users/barend/Developer/CSharp/HelloMac/obj/Debug/actool/partial-info.plist --app-icon AppIcon --minimum-deployment-target 10.14 --platform macosx --compile /Users/barend/Developer/CSharp/HelloMac/obj/Debug/actool/bundle /Users/barend/Developer/CSharp/HelloMac/obj/Debug/actool/cloned-assets/Assets.xcassets
Target _CoreCompileInterfaceDefinitions:
    Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution started with arguments: --errors --warnings --notices --output-format xml1 --minimum-deployment-target 10.14 --sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk --compilation-directory /Users/barend/Developer/CSharp/HelloMac/obj/Debug/ibtool /Users/barend/Developer/CSharp/HelloMac/Main.storyboard
      BundleResources Output:
        obj/Debug/ibtool/Main.storyboardc/Info.plist
        obj/Debug/ibtool/Main.storyboardc/MainMenu.nib
        obj/Debug/ibtool/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib
        obj/Debug/ibtool/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib
      OutputManifests Output:
        obj/Debug/ibtool-manifests/Main.storyboardc
Target _CoreCompileColladaAssets:
  Skipping target "_CoreCompileColladaAssets" because it has no inputs.
Target GenerateTargetFrameworkMonikerAttribute:
  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
Target CoreCompile:
    /Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/msbuild/15.0/bin/Roslyn/csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:__UNIFIED__;__MACOS__;DEBUG /errorendlocation /preferreduilang:en-US /reference:/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/mscorlib.dll /reference:/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/System.Core.dll /reference:/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/System.dll /reference:/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/Xamarin.Mac.dll /debug+ /debug:portable /optimize- /out:"obj/Debug/Hello, Mac.exe" /target:exe /utf8output Main.cs AppDelegate.cs ViewController.cs ViewController.designer.cs "/var/folders/sp/h_fxglts44j6c7604d9t_vhm0000gn/T/Xamarin.Mac,Version=v2.0.AssemblyAttributes.cs"
Target CopyFilesToOutputDirectory:
    Copying file from "/Users/barend/Developer/CSharp/HelloMac/obj/Debug/Hello, Mac.exe" to "/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.exe".
    HelloMac -> /Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.exe
    Copying file from "/Users/barend/Developer/CSharp/HelloMac/obj/Debug/Hello, Mac.pdb" to "/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.pdb".
Target _DetectSigningIdentity:
    Detected signing identity:
      Bundle Id: nl.pagebrain.HelloMac
      App Id: nl.pagebrain.HelloMac
Target _CopyContentToBundle:
    Creating directory '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources'
    Copying file from '/Users/barend/Developer/CSharp/HelloMac/obj/Debug/actool/bundle/AppIcon.icns' to '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources/AppIcon.icns'
    Copying file from '/Users/barend/Developer/CSharp/HelloMac/obj/Debug/actool/bundle/Assets.car' to '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources/Assets.car'
    Creating directory '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources/Main.storyboardc'
    Copying file from '/Users/barend/Developer/CSharp/HelloMac/obj/Debug/ibtool/Main.storyboardc/Info.plist' to '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources/Main.storyboardc/Info.plist'
    Copying file from '/Users/barend/Developer/CSharp/HelloMac/obj/Debug/ibtool/Main.storyboardc/MainMenu.nib' to '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources/Main.storyboardc/MainMenu.nib'
    Copying file from '/Users/barend/Developer/CSharp/HelloMac/obj/Debug/ibtool/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib' to '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib'
    Copying file from '/Users/barend/Developer/CSharp/HelloMac/obj/Debug/ibtool/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib' to '/Users/barend/Developer/CSharp/HelloMac/bin/Debug/Hello, Mac.app/Contents/Resources/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib'
Target _CompileToNative:
    /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp @/Users/barend/Developer/CSharp/HelloMac/obj/Debug/response-file.rsp 
    MMP : error MM0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
    System.ArgumentException: Malformed name
      at Mono.Cecil.AssemblyNameReference.Parse (System.String fullName) [0x00159] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/cecil/Mono.Cecil/AssemblyNameReference.cs:208 
      at Xamarin.Bundler.MonoMacResolver.Resolve (System.String fullName) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/resolver.cs:45 
      at Xamarin.Bundler.MonoMacResolver.GetAssembly (System.String fileName) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/resolver.cs:40 
      at Xamarin.Bundler.Driver.Link () [0x00053] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/driver.cs:1472 
      at Xamarin.Bundler.Driver.Pack (System.Collections.Generic.IList`1[T] unprocessed) [0x004a6] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/driver.cs:818 
      at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x0112d] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/driver.cs:516 
      at Xamarin.Bundler.Driver.Main (System.String[] args) [0x00015] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/driver.cs:211 
Done building target "_CompileToNative" in project "HelloMac.csproj" -- FAILED.

Done building project "HelloMac.csproj" -- FAILED.

Build FAILED.

MMP : error MM0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:04.05

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Build: 1 error, 0 warnings

Example Project (If Possible)

HelloMac.zip

bvanrijn commented 5 years ago

I'm not entirely sure where I read this, but it seems that the culprit was the display name of the app. I had changed it to "Hello, Mac" (mind the comma) instead of "Hello_Mac" as is used in the tutorial.

Following the tutorial in record time, making sure not to change the display name, everything works!

I still think this error message should be updated.

dalexsoto commented 5 years ago

Hello @bvanrijn!

Thank you so much for your report! You are completely right, we should do a better job when providing invalid assembly names into our tooling, I will make sure to mark this enhancement request as such.

Again, thank you for your report!

screen shot 2019-02-05 at 7 01 26 pm
spouliot commented 5 years ago

MM0000 or MT0000 are bugs (missing validations) since they do not provide an actionable description to solve the issue.

spouliot commented 5 years ago

This works fine in iOS (even if the name will be without a space and comma when using the project's wizard) and it's also a valid assembly name (as far as .net is concerned).

spouliot commented 5 years ago

Actually it works on iOS simulator but on device the AOT compiler is not happy.

/Users/poupou/Projects/HelloMac/HelloiOS/MTOUCH: Error MT3001: Could not AOT the assembly '/Users/poupou/Projects/HelloMac/HelloiOS/obj/iPhone/Debug/device-builds/iphone11.6-12.1.4/mtouch-cache/3-Build/Hello, iOS.exe' (MT3001) (HelloiOS)