Running websharper.ui.next on OSx complains with a mcs error - xamarin

I've got a websharper project that runs flawlessly on windows. However it only compiles flawlessly on mac but can't be run. The webserver complains that it can find a file (doesn't name it) and reading the stacktrace it seems to be the C# compiler complaining. However being an F# project that's somewhat surprising.
System.SystemException
Error running mcs: Cannot find the specified file
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.
Exception stack trace:
at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00135] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs:216
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00011] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs:136
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00014] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs:111
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x002e8] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:822
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:731
at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp, Boolean debug) [0x00264] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:826
at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath vp, Boolean debug) [0x0011c] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:451
at System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath vp) [0x00056] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:396
at System.Web.Compilation.BuildManager.GetCompiledType (System.Web.VirtualPath virtualPath) [0x00040] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:989
at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:972
at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x0016b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr4/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.4/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs:417
ANy suggestions to what could be the root of this problem?

Seems like a mono installation issue. A similar exception is happening in this ticket: https://forums.xamarin.com/discussion/50713/error-running-mcs-cannot-find-the-specified-file

Upgrading to mono 4.2 alpha resolves the issue. I do however think it can be solved with 4.0 as well since I have had the same web site running on a different Mac without installing 4.2

Related

UnauthorizedAccessException: Access to the path [ios/ Mac os Mojava / Unity 19.2.0] failing to build project

I was able to build the exact same project on the exact same Macbook pro last week but now I no longer am and I don't understand why.
Now when I first open the project (I am primarily working on a windows computer for the android version of this project, using the mac just to make builds) it says:
An error occurred while resolving packages:
One or more packages could not be added to the local file system:
com.unity.collab-proxy: EPERM: operation not permitted, unlink '/Users/dondoo/Desktop/Grove_Anniversary/Library/PackageCache/com.unity.collab-proxy#1.2.16/CHANGELOG.md'
com.unity.ext.nunit: EPERM: operation not permitted, unlink '/Users/dondoo/Desktop/Grove_Anniversary/Library/PackageCache/com.unity.ext.nunit#1.0.0/.gitlab-ci.yml'
com.unity.ide.rider: EPERM: operation not permitted, unlink '/Users/dondoo/Desktop/Grove_Anniversary/Library/PackageCache/com.unity.ide.rider#1.0.8/.editorconfig'
com.unity.ide.vscode: EPERM: operation not permitted, unlink '/Users/dondoo/Desktop/Grove_Anniversary/Library/PackageCache/com.unity.ide.vscode#1.0.7/CHANGELOG.md.meta'
com.unity.test-framework: EPERM: operation not permitted, unlink '/Users/dondoo/Desktop/Grove_Anniversary/Library/PackageCache/com.unity.test-framework#1.0.13/CHANGELOG.md'
com.unity.textmeshpro: EPERM: operation not permitted, unlink '/Users/dondoo/Desktop/Grove_Anniversary/Library/PackageCache/com.unity.textmeshpro#2.0.1/.gitlab-ci.yml'
It crashes after that then when I reopen it there is no issue but when i try build then I get this error:
UnauthorizedAccessException: Access to the path "/Users/dondoo/Desktop/Grove_Anniversary/Temp/StagingArea/Data/Managed/Vuforia.UnityExtensions.dll" is denied.
System.IO.File.Delete (System.String path) (at <a8ed250850854b439cedc18931a314fe>:0)
UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (System.Collections.IEnumerable assemblies, System.String managedAssemblyFolderPath, System.String[] assembliesToStrip, System.String[] searchDirs, System.String monoLinkerPath, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:412)
UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:246)
UnityEditorInternal.IL2CPPBuilder.Run () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:326)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
UnityEditor.iOS.PostProcessiPhonePlayer.CrossCompileManagedDlls (UnityEditor.iOS.PostProcessiPhonePlayer+BuildSettings bs, UnityEditor.iOS.PostProcessiPhonePlayer+ProjectPaths paths, UnityEditor.AssemblyReferenceChecker checker, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport buildReport) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:813)
UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.PostProcessiPhonePlayer+BuildSettings bs, UnityEditor.iOS.PostProcessiPhonePlayer+ProjectPaths paths, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport buildReport) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:635)
UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.PostProcessorSettings postProcessorSettings, UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:582)
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/ExtensionModule.cs:45)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/ExtensionModule.cs:49)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:27)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
I have tried reimporting everything.
I have tried different versions of unity.
I can't build on a windows pc, because firebase doesn't allow ios builds from a computer that's not using MacOsX.
The short answer is that it's safe to delete the Library directory if Unity is running. I actually add Library, Temp, obj, and Logs to my .gitignore file when sharing a project between machines.
I do notice /Users/dondoo and /Users/builduser in your logs. You also want to make sure that whichever user account needs access to your Unity project can get it (ie: if you're running Unity as builduser but the folder is only accessible by dondoo, you'll have a bad time). Since you appear to have an issue in the auto generated Library directory, this could be the case. Also, you may have an issue if you currently have the project open by another instance of Unity (ex: you're editing as dondoo but then builduser tries to make an automated build).
Hopefully my first answer fixes it, but if not there are a few things to check out!
--Patrick
I solved the problem by deleting the library and Temp Folders the project came with and letting unity rebuild them.

Getting Exception: Invalid PBX project (parsing line 0) when running iOS build on Unity3D

I've been trying to nail this one down for weeks. I haven't been able to come up with a solution to correct this. I'm using the latest GoogleMobileAds.
Exception: Invalid PBX project (parsing line 0)
UnityEditor.iOS.Xcode.PBX.Parser.ParseTree () (at
/Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/XCode/PBX/Parser.cs:114)
UnityEditor.iOS.Xcode.PBXProjectData.ParseContent (System.String
content) (at
/Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/XCode/PBXProjectData.cs:451)
UnityEditor.iOS.Xcode.PBXProjectData.ReadFromStream
(System.IO.TextReader sr) (at
/Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/XCode/PBXProjectData.cs:458)
UnityEditor.iOS.Xcode.PBXProject.ReadFromStream (System.IO.TextReader
sr) (at
/Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/XCode/PBXProject.cs:868)
UnityEditor.iOS.Xcode.PBXProject.ReadFromString (System.String src)
(at
/Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/XCode/PBXProject.cs:863)
GoogleMobileAds.Postprocessor.runPodUpdate (System.String path) (at
Assets/GoogleMobileAds/Editor/PostProcessor.cs:56)
GoogleMobileAds.Postprocessor.OnPostprocessBuild (BuildTarget target,
System.String pathToBuiltProject) (at
Assets/GoogleMobileAds/Editor/PostProcessor.cs:27)
UnityEditor.HostView:OnGUI()
Thanks!

System.PlatformNotSupportedException when making calls from iPhone client

I'm trying to have Tasks working under Visual Studio 2012 with MonoTouch. I'm using ALPHA channel and have the latest releases installed.
There are 3 projects in solution:
1. PCL (158 target platforms) with async methods
2. Touch
3. Android
This code compiles, could be deployed and executed. But when I make calls from iPhone client:
var asyncResult = await MyClass.DoStuff();
Console.WriteLine("doing stuff completed: " + asyncResult);
I get the following result:
System.PlatformNotSupportedException: This platform is not supported
at await part of code. When I write it with Task.ContinueWith - same result.
What is interesting is doesn't work only under Visual Studio + MonoTouch. All other configurations launches this code correctly (WIN+VS+Android, WIN+VS+Android, MAC+XS+iOS, MAC+XS+Android)
Versions of SDK are synchronized with the latest ALPHA release.
Exception details:
Unhandled Exception:
System.PlatformNotSupportedException: This platform is not supported.
2013-07-25 11:45:32.384 iPhone[1817:907] Unhandled managed exception: This platform is not supported. (System.PlatformNotSupportedException)
at System.ExecutionContextLightup.Run (System.ExecutionContextLightup executionContext, System.Action`1 callback, System.Object state) [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <filename unknown>:0
at Microsoft.Runtime.CompilerServices.TaskAwaiter+<>c__DisplayClassa.<OnCompletedInternal>b__1 (System.Object state) [0x00000] in <filename unknown>:0
at MonoTouch.UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey52.<>m__4E () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIKitSynchronizationContext.cs:24
at MonoTouch.Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSAction.cs:87
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at
MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at iPhone.Application.Main (System.String[] args) [0x00001] in c:\Sources\Local\PCL_XN\iPhone\Main.cs:17
The program 'Mono' has exited with code 0 (0x0).
The program '[6760] iPhone.vshost.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).
A bit of a late reply, but in case anyone is still running into this, it looks like one workaround is to add --nolinkaway --linkskip=mscorlib under "Project Options -> iOS Build -> Additional mtouch arguments" for the main application project.
Without this, the linker removes something from mscorlib that the Microsoft.Bcl package requires for its compatibility checks.
Bug filed here: https://bugzilla.xamarin.com/show_bug.cgi?id=15290

Could not load type 'System.Runtime.Serialization.Json.DataContractJsonSerializer'

I am new to mono/linux and I've tried to host my existing asp.net mvc3 website on ubuntu/apache2 using mod_mono. Everything goes ok except the calls to a ServiceStack service which seem to fail when deserializing the response from the service (the service is located on the same machine hosted in a different proc). I have looked at the mono gac and the assembly is there (correct version/key). Moreover if I run the website from monodevelop/xsp everything works just fine. Any idea as to why is the type load failing is appreciated.
Could not load type 'System.Runtime.Serialization.Json.DataContractJsonSerializer' from assembly 'System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Stack Trace:
System.TypeLoadException: Could not load type 'System.Runtime.Serialization.Json.DataContractJsonSerializer' from assembly 'System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at ServiceStack.ServiceClient.Web.JsonServiceClient.DeserializeFromStream[List`1] (System.IO.Stream stream) [0x00000] in :0
at ServiceStack.ServiceClient.Web.ServiceClientBase.HandleResponse[List`1] (System.Net.WebResponse webResponse) [0x00000] in :0
at ServiceStack.ServiceClient.Web.ServiceClientBase.Send[List`1] (System.String httpMethod, System.String relativeOrAbsoluteUrl, System.Object request) [0x00000] in :0
I am using:
Mono Runtime Version: 2.10.8.1 (Debian 2.10.8.1-5ubuntu1);
ASP.NET Version: 4.0.30319.1
ServiceStack 3.9.32
I was having the same issue. It's happening because the 3.5 version of System.ServiceModel.Web can't be found at runtime by the ServiceStack libraries. I copied the 3.5 version out of the mono "gac" into my applications bin directory and everything started working correctly. The paths may be different on your system/deployment but here is what I used:
cp /usr/lib/mono/gac/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/System.ServiceModel.Web.dll /var/www/path/to/web/app/bin/

Zip file on Mac usingICSharp

I am using mono and monobjc to develop an application to run on Mac OS X 10.6. I am adding some files to a zip file using ICSharpCode.SharpZip. The code is as -
var ms = new MemoryStream();
var zipStream = new ZipOutputStream(ms);
zipStream.PutNextEntry(new ZipEntry(Path.GetFileName(file))
{DateTime = File.GetCreationTime(file),
Size = new FileInfo(file).Length});
Sometimes, not always, The PutNewEntry code throws the following exception -
System.NotSupportedException: CodePage 437 not supported
at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in :0
at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToArray (System.String str) [0x00000] in :0
at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToArray (Int32 flags, System.String str) [0x00000] in :0
at ICSharpCode.SharpZipLib.Zip.ZipOutputStream.PutNextEntry (ICSharpCode.SharpZipLib.Zip.ZipEntry entry) [0x00000] in :0
at (wrapper remoting-invoke-with-check) ICSharpCode.SharpZipLib.Zip.ZipOutputStream:PutNextEntry (ICSharpCode.SharpZipLib.Zip.ZipEntry)
I have the following two questions -
What is the causing the above exception.
It looks like ICSharp may not be the best option. What are the better alternatives?.
I fixed this by creating a tar.gzip instead of using zip. I used ICSharp itself to create the tar file. Mac does not seem to like zip. It could also be because I was using the ICSharp in Mono framework on Mac side and using ICSharp(download from the web) on the windows side. But using tar.gzip resolved this issue.

Resources