Visual Studio for Mac won't start after updating to version 7.5.3 - Assemblies not properly installed in the GAC - mono

I updated Visual studio for mac from beta channel to latest stable channel and now it does't start anymore.
I reinstalled it and still doesn't start.
Here is a portion of the logs:
INFO [2018-07-04 00:16:23Z]: Starting Visual Studio 2017 for Mac 7.5.3 (build 7)
INFO [2018-07-04 00:16:23Z]: Running on Mono 5.10.1.57 (2017-12/ea8a24b1bbf) (64-bit)
INFO [2018-07-04 00:16:23Z]: Operating System: Mac OS X 10.13.5
Darwin 17.6.0 Darwin Kernel Version 17.6.0
Tue May 8 15:22:16 PDT 2018
root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
INFO [2018-07-04 00:16:23Z]: GTK: Using gtkrc from /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/gtkrc.mac
Could not find `Microsoft.Build.Framework` referenced by assembly `MonoDevelop.Core, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3ead7498f347467b`.
...
Starting Visual Studio
FATAL ERROR [2018-07-04 00:16:30Z]: Visual Studio failed to start. Some of the assemblies required to run Visual Studio (for example gtk-sharp)may not be properly installed in the GAC.
System.InvalidOperationException: Extension node not found in path: /MonoDevelop/Core/PlatformService
at Mono.Addins.ExtensionContext.GetExtensionObjects (System.String path, System.Type arrayElementType, System.Boolean reuseCachedInstance) [0x0001c] in /Users/builder/data/lanes/5965/13cecd02/source/monodevelop/main/external/mono-addins/Mono.Addins/Mono.Addins/ExtensionContext.cs:670
at Mono.Addins.ExtensionContext.GetExtensionObjects (System.String path) [0x00000] in /Users/builder/data/lanes/5965/13cecd02/source/monodevelop/main/external/mono-addins/Mono.Addins/Mono.Addins/ExtensionContext.cs:534
at Mono.Addins.AddinManager.GetExtensionObjects (System.String path) [0x0000a] in /Users/builder/data/lanes/5965/13cecd02/source/monodevelop/main/external/mono-addins/Mono.Addins/Mono.Addins/AddinManager.cs:554
at MonoDevelop.Ide.DesktopService.Initialize () [0x00008] in /Users/builder/data/lanes/5965/13cecd02/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs:57
at MonoDevelop.Ide.IdeStartup.Run (MonoDevelop.Ide.MonoDevelopOptions options) [0x0030b] in /Users/builder/data/lanes/5965/13cecd02/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:178
at MonoDevelop.Ide.IdeStartup.Main (System.String[] args, MonoDevelop.Ide.Extensions.IdeCustomizer customizer) [0x0008f] in /Users/builder/data/lanes/5965/13cecd02/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:627

It seems I encountered a known issue. A workaround is described here and it worked for me. It says to delete that folder: ~/Library/Caches/VisualStudio/7.0/addin-db-002/

Related

"Could not load file or assembly or one of its dependencies" in Mono but not in native .NET

The same executable that uses some proprietary DLLs, after being compiled with Mono, works natively on Windows, but doesn't work using Mono on Windows or Linux.
hello_onbase.cs:
using Hyland.Unity;
using Hyland.Types;
using System;
public class HelloOnBase
{
public static void Main(string[] args)
{
var auth = Application.CreateOnBaseAuthenticationProperties("app_server_url", "user", "password", "data_source");
var app = Application.Connect(auth);
Console.WriteLine ("OnBase connection successful!");
}
}
Proprietary DLLs Hyland.Unity.dll and Hyland.Types.dll are in the same directory as the file hello_onbase.cs. Unfortunately I can't share those files since they're the IP of our vendor, I'm very sorry...
I opened Mono x64 Command Prompt in Windows and compiled the file successfully with Mono:
C:\Users\apanasenco\git\docaccess\services\doc\onbase>csc -r:Hyland.Types.dll -r:Hyland.Unity.dll hello_onbase.cs
Microsoft (R) Visual C# Compiler version 3.6.0-4.20224.5 (ec77c100)
Copyright (C) Microsoft Corporation. All rights reserved.
The executable Mono compiled executes just fine natively in Windows:
C:\Users\apanasenco\git\docaccess\services\doc\onbase>hello_onbase.exe
OnBase connection successful!
However, running the executable with mono causes the following error:
C:\Users\apanasenco\git\docaccess\services\doc\onbase>mono hello_onbase.exe
Unhandled Exception:
System.TypeLoadException: Could not set up parent class, due to: Could not set up parent class, due to: Could not load type of field 'Hyland.Types.EncryptedServiceObject:_scp' (2) due to: Could not load file or assembly 'Hyland.Security.Legacy, Version=0.2.2.0, Culture=neutral, PublicKeyToken=e169a6a902bdd7a6' or one of its dependencies. assembly:C:\Users\apanasenco\git\docaccess\services\doc\onbase\Hyland.Types.dll type:EncryptedServiceObject member:(null) assembly:C:\Users\apanasenco\git\docaccess\services\doc\onbase\Hyland.Types.dll type:ParameterizedObject member:(null)
at Hyland.Unity.OnBaseAuthenticationProperties.ConnectNormalMode (Hyland.Unity.Services.IConnectServiceAccess connectServiceAccess) [0x00000] in <80532c8c2f134d0daba2ee8243cb5721>:0
at Hyland.Unity.OnBaseAuthenticationProperties.ConnectAndGetIntegrationApplicationOptions (Hyland.Unity.Services.IConnectServiceAccess connectServiceAccess) [0x00020] in <80532c8c2f134d0daba2ee8243cb5721>:0
at Hyland.Unity.Application.Connect (Hyland.Unity.AuthenticationProperties connectProperties) [0x00020] in <80532c8c2f134d0daba2ee8243cb5721>:0
at HelloOnBase.Main (System.String[] args) [0x0001b] in <73b1617068fa44e792f55cccc5974b17>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not set up parent class, due to: Could not set up parent class, due to: Could not load type of field 'Hyland.Types.EncryptedServiceObject:_scp' (2) due to: Could not load file or assembly 'Hyland.Security.Legacy, Version=0.2.2.0, Culture=neutral, PublicKeyToken=e169a6a902bdd7a6' or one of its dependencies. assembly:C:\Users\apanasenco\git\docaccess\services\doc\onbase\Hyland.Types.dll type:EncryptedServiceObject member:(null) assembly:C:\Users\apanasenco\git\docaccess\services\doc\onbase\Hyland.Types.dll type:ParameterizedObject member:(null)
at Hyland.Unity.OnBaseAuthenticationProperties.ConnectNormalMode (Hyland.Unity.Services.IConnectServiceAccess connectServiceAccess) [0x00000] in <80532c8c2f134d0daba2ee8243cb5721>:0
at Hyland.Unity.OnBaseAuthenticationProperties.ConnectAndGetIntegrationApplicationOptions (Hyland.Unity.Services.IConnectServiceAccess connectServiceAccess) [0x00020] in <80532c8c2f134d0daba2ee8243cb5721>:0
at Hyland.Unity.Application.Connect (Hyland.Unity.AuthenticationProperties connectProperties) [0x00020] in <80532c8c2f134d0daba2ee8243cb5721>:0
at HelloOnBase.Main (System.String[] args) [0x0001b] in <73b1617068fa44e792f55cccc5974b17>:0
Mono version on Windows and Linux: 6.12.0
The older versions of these two files used to work on Mono before... I'm wondering if there's some Mono setting I can tweak to relax some assembly checks to match native .NET behavior?
Turns out the vendor does provide a file Hyland.Security.Legacy.dll that was alluded to in the error message. Including that file resolved the issue.

Mono Framework Build Error - Mac OSX

When using the Mono framework 5.10.0.16 (regardless of IDE: VS for Mac, JetBrains Rider and MonoDevelop) the same error occurs and I cannot make sense of it:
Microsoft.VisualBasic.Core.targets(73, 5): [MSB3883] Unexpected exception:
Microsoft.VisualBasic.Core.targets(73, 5): [null] System.ComponentModel.Win32Exception (0x80004005): ApplicationName='vbnc.exe', CommandLine=' /noconfig #"/var/folders/sj/sblgn2q93b1084nm213419f80000gn/T/tmp54fb2d36c21545118516981a1817b134.rsp"', CurrentDirectory='', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <f8bb3922e51744d9ace1aa6aedc374ea>:0
at System.Diagnostics.Process.Start () [0x0003a] in <f8bb3922e51744d9ace1aa6aedc374ea>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at Microsoft.Build.Utilities.ToolTask.ExecuteTool (System.String pathToTool, System.String responseFileCommands, System.String commandLineCommands) [0x000c9] in <0027e94ddd2948b0b937f5e2d51fcfe1>:0
at Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler.ExecuteTool (System.String pathToTool, System.String responseFileCommands, System.String commandLineCommands) [0x00066] in <896b154c97654cea80889fd96e18abdc>:0
I have tried installing different versions, the error persists, I'm not sure what to make of it but I notice a vnbc.exe
I am using MacOSX version 10.13.4
This issue in mono https://github.com/mono/mono/issues/7756. It's already fixed. We are waiting for new release.

How to run NUnit 3.0 with Mono 4.0 runtime?

I'm trying to run a test assembly built with .NET Framework 4.5.1 on Mono 4.0 and NUnit 3.0 on Windows.
Does anyone know how to make nunit-console.exe see the Mono 4.0 runtime that is installed on my machine and stop saying it is unknown or not available?
If I run nunit-console.exe through mono and set the target framework:
mono C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe --framework=mono-4.0 "C:\MyTestAssembly.dll"
NUnit Console Runner 3.0.5610
Copyright (C) 2014 Charlie Poole
Test Files
C:\MyTestAssembly.dll
Runtime Environment
OS Version: Microsoft Windows NT 6.3.9600.0
CLR Version: 4.0.30319.0
Options
ProcessModel: Default DomainUsage: Default
Execution Runtime: mono-4.0
Work Directory: C:\
Internal Trace: Off
The requested framework mono-4.0 is unknown or not available.
If I run nunit-console.exe directly, without mono, the output is the same:
C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe --framework=mono-4.0 "C:\MyTestAssembly.dll"
If I run nunit-console.exe through mono but without the target framework, the output changes:
mono C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe "C:\MyTestAssembly.dll"
NUnit Console Runner 3.0.5610
Copyright (C) 2014 Charlie Poole
Test Files
C:\MyTestAssembly.dll
Runtime Environment
OS Version: Microsoft Windows NT 6.3.9600.0
CLR Version: 4.0.30319.0
Options
ProcessModel: Default DomainUsage: Default
Execution Runtime: Not Specified
Work Directory: H:\Safe\Desenvolvimento\Concert\Reactive Services
Internal Trace: Off
System.ArgumentException: The mono-4.0 framework is not available
Parameter name: framework
at NUnit.Engine.Services.TestAgency.LaunchAgentProcess (NUnit.Engine.TestPackage package) [0x00000] in :0
at NUnit.Engine.Services.TestAgency.CreateRemoteAgent (NUnit.Engine.TestPackage package, Int32 waitTime) [0x00000] in
:0
at NUnit.Engine.Services.TestAgency.GetAgent (NUnit.Engine.TestPackage package, Int32 waitTime) [0x00000] in :0
at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.TestAgency:GetAgent (NUnit.Engine.TestPackage,int)
at NUnit.Engine.Runners.ProcessRunner.LoadPackage () [0x00000] in :0
And finally, if I run the last option using NUnit 2.6.4, the test runs but the mono process hangs at the end.
mono C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe "C:\MyTestAssembly.dll"
And if I run without mono and the target framework using NUnit 2.6.4 or NUnit 3.0, the test runs and the process ends normally.
C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe "C:\MyTestAssembly.dll"
C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe "C:\MyTestAssembly.dll"
You have to use NUnit embedded in Mono. Execute the following commands in console:
cd C:\Program Files (x86)\Mono\bin
nunit-console4 *PATH TO YOUR .Tests.dll*

.Net/Mono & Ubuntu versus log4net

I've been asked to write a small instrument-calibration app on Ubuntu Linux (14.04) and have been writing some small proof-of-concept apps (serial i/o, GUI, SQLite, etc.) to see if Mono is a good fit. Things were going well until I tested log4net, my favorite logging package. I cannot get the code to work. Here's a simple test app that works fine on a Windows box:
using System;
using log4net;
using log4net.Config;
public class L
{
public static void Main(string[] args)
{
Console.WriteLine("Version: " + Environment.Version);
XmlConfigurator.Configure(
new System.IO.FileInfo("console.logconfig.xml"));
Console.WriteLine("logging configured.");
ILog log = LogManager.GetLogger("root");
log.Info("This is an info message.");
log.Warn("This is a warning message.");
log.Error("This is an error message.");
}
}
Compiled with
gmcs -pkg:log4net,dotnet -main:L -out:L.exe L.cs
the code compiles, but generates a runtime error:
Version: 2.0.50727.1433
Missing method System.Reflection.Assembly::op_Equality(Assembly,Assembly) in assembly /usr/lib/mono/2.0/mscorlib.dll, referenced in assembly /usr/lib/mono/gac/log4net/1.2.10.0__a5715cc6d5c3540b/log4net.dll
Unhandled Exception:
System.MissingMethodException: Method not found: 'System.Reflection.Assembly.op_Equality'.
at log4net.LogManager.GetRepository (System.Reflection.Assembly repositoryAssembly) [0x00000] in <filename unknown>:0
at log4net.Config.XmlConfigurator.Configure (System.IO.FileInfo configFile) [0x00000] in <filename unknown>:0
at L.Main (System.String[] args) [0x00000] in <filename unknown>:0
This looks like a .Net version mismatch (maybe op_equality wasn't available in .Net 2.0?). When I try to force version 4 or 4.5 of the SDK:
gmcs -sdk:4.5 -pkg:log4n35,dotnet -main:L -out:L.exe L.cs
I get a compile error:
error CS0006: Metadata file `cscompmgd.dll' could not be found
This is on a brand-new Ubuntu 14.04 VM with Mono installed via:
sudo apt-get install mono-complete
sudo apt-get install liblog4net1.2-cil
sudo apt-get install liblog4net-cil-dev
Recommendations, please?
Unfortunately the version of log4net packaged for Ubuntu (1.2.10) is pretty old and known to have problems with .NET 4.0. 1.2.11 has been released in October 2011 and as of this writing 1.2.13 is the latest release.
You need to download the latest version from the Apache log4net site directly: http://logging.apache.org/log4net/download_log4net.cgi
You almost had it; Ubuntu 14.04:
gmcs -sdk:4.5 -r:/usr/lib/cli/log4net-1.2/log4net.dll App.cs

Not able to open MonoDevelop v 2.4.2

When I try to open MonoDevelop this error appears in the console log
com.apple.launchd.peruser.501[249] ([0x0-0x13013].com.ximian.monodevelop[308]) Exited with exit code: 255
How can I fix the problem?
EDIT: Snow Leopard 10.6.8, MonoDevelop 2.4.2 and Mono 2.10.5.
UPDATE: This is the error if I try to run MonoDevelop from shell
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/MonoDevelop.app.
UPDATE 2: I've found the crash reporter for mono
FATAL ERROR [2011-09-03 15:06:25Z]: MonoDevelop failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.
System.DllNotFoundException: /Library/Frameworks/Mono.framework/Versions/2.10.5/lib/libgtk-quartz-2.0.0.dylib
at (wrapper managed-to-native) Gtk.Application:gtk_init (int&,intptr&)
at Gtk.Application.do_init (System.String progname, System.String[]& args, Boolean check) [0x00000] in <filename unknown>:0
at Gtk.Application.Init (System.String progname, System.String[]& args) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.IdeStartup.Run (System.String[] args) [0x00000] in <filename unknown>:0
at MonoDevelop.Startup.MonoDevelopMain.Main (System.String[] args) [0x00000] in <filename unknown>:0
Any help?
For those interested in:
Uninstall Mono with this script uninstall script. You have to save the script in a file with extension .sh
Save the file in the desktop as uninstallMonoFr.sh (for example)
Open a terminal window: cd Desktop, sudo ./uninstallMonoFr.sh, insert your pwd
Download mono framework 2.10.4 (this version works for me)
Install again
I don't know if the problem is due to 2.10.5 version of mono framework. 2.10.4 works well.
UPDATE Seems that Mono 2.10.5 still presenting a package bug. MonoDevelop can't open with this version. Mono 2.10.4 works.
UPDATE 2 I've just installed 2.10.6 and it works. MonoDevelop now opens correctly.
This also helped me (permission issue):
http://answers.unity3d.com/questions/277759/cannot-start-built-in-monodevelop.html
I just added myself (user) with read&write permissions.