mono Run Time Exception on Catalina MacOS - mono

I have an application that is made by .NET and i use mono 6.4.0.198 (i use the newest mono so the app is compatible with Catalina MacOS) to run it on the Mac machine, on my machine the mono is installed so the app works fine, but when i run the app on other Macs it return the following exception
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Diagnostics.SystemDiagnosticsSection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Diagnostics.AssertSection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ComponentModel.TypeDescriptor' threw an exception. ---> System.DllNotFoundException: /libmono-native-compat.dylib assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Interop+Sys.GetNonCryptographicallySecureRandomBytes(byte*,int)
at Interop.GetRandomBytes (System.Byte* buffer, System.Int32 length) [0x00000] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.Guid.NewGuid () [0x00000] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.ComponentModel.TypeDescriptor..cctor () [0x00034] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationProperty..ctor (System.String name, System.Type type, System.Object defaultValue, System.Configuration.ConfigurationPropertyOptions options) [0x00000] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Diagnostics.AssertSection..cctor () [0x00000] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at System.Diagnostics.SystemDiagnosticsSection..cctor () [0x00000] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in <b814b509d4ad406fb40c6c93e38929e7>:0
--- End of inner exception stack trace ---
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x0001a] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00095] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) [0x00009] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) [0x00027] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00020] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.Configuration.ConfigInfo.CreateInstance () [0x00026] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Configuration.SectionInfo.CreateInstance () [0x00000] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, System.Boolean createDefaultInstance) [0x0001c] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x0002c] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Configuration.Configuration.GetSection (System.String sectionName) [0x00016] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00006] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00005] in <181a8ffed1274b05b3ed7ea8bc6e1333>:0
at System.Configuration.PrivilegedConfigurationManager.GetSection (System.String sectionName) [0x00000] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection () [0x00000] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
at System.Diagnostics.DiagnosticsConfiguration.Initialize () [0x0002a] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize () [0x00000] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
at System.Diagnostics.TraceInternal.InitializeSettings () [0x0004e] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
at System.Diagnostics.TraceInternal.get_Listeners () [0x00000] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
at System.Diagnostics.Trace.get_Listeners () [0x00000] in <6aa0b19d109a447c94d1b43ec4471dc6>:0
at Zoolz.Program.Main (System.String[] args) [0x00040] in <d6a87962027b42c6878475ce75623731>:0
clearly its a missing dll libmono-native-compat.dylib i added this dll at the application resources alongside other dlls but the app still returning the same missing dll exception, how i can direct mono to dll so i would fix this problem

I had many errors when I installed the macOS Catalina until I decide to give permission to my /private/tmp folder. It seems all apps work now. I don't know if it's your case but just in case try this:
sudo chmod 777 /private/tmp

I solved this issue by
creating a file called fix.config and it contains the following XML
<configuration>
<dllmap dll="System.Native" target="libmono-native-compat.dylib" os="!windows" />
<dllmap dll="System.Net.Security.Native" target="libmono-native-compat.dylib" os="!windows" />
<dllmap dll="System.Security.Cryptography.Native.Apple" target="libmono-native-compat.dylib" os="osx" />
</configuration>
the i copied the three dylibs that are mentioned in the XML to the path Application/MyApp.app/Contents/lib
then in the in the building script i added to the tool mkbundle the following command
--config $SETUP_DIR/fix.config and setup path is the path where im creating my .pkg file
NOTE: im using mono version 6.4.0.198

Related

monodevelop not launching executable

I need to launch an .exe executable, so I installed monodevelop:
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
Suspend: hybrid
GC: sgen (concurrent by default)
with all its dependancies.
Monodevelop can be opened from the App manager, but when I try to execute the app that I want with:
sudo mono UnigeGpioBoard.exe
I obtain the following Unhandled Exception error, which I cannot understand.
Unhandled Exception:
System.IO.DirectoryNotFoundException: Could not find a part of the path "/home/lorenzo/T2K-uniGe/FEB_GPIO/FEB-GPIO_firmware/UT_60charge/etc/FrontEnd/Crash_4/12/2022_2:52:34_PM.log".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x001ac] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) [0x00061] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.IO.StreamWriter..ctor (System.String path) [0x00008] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string)
at System.IO.File.WriteAllText (System.String path, System.String contents) [0x0002c] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at UnigeGpioBoard.App.MainClass.Main (System.String[] args) [0x000e1] in <c165a6db1da14092976c38f3925fcc71>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path "/home/lorenzo/T2K-uniGe/FEB_GPIO/FEB-GPIO_firmware/UT_60charge/etc/FrontEnd/Crash_4/12/2022_2:52:34_PM.log".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x001ac] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) [0x00061] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.IO.StreamWriter..ctor (System.String path) [0x00008] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string)
at System.IO.File.WriteAllText (System.String path, System.String contents) [0x0002c] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at UnigeGpioBoard.App.MainClass.Main (System.String[] args) [0x000e1] in <c165a6db1da14092976c38f3925fcc71>:0
Any help is appreciated, I work with Ubuntu 20.04.4

Error building Xamarin iOS project

After switching to the unified API, while I try to build an iOS application using Xamarin.iOS, I'm getting an error:
error : Error building target _DetectSigningIdentity: Unknown char
Anyone has an idea how to solve it or understands what causes this error?
This is the detailed trace:
error : Error building target _DetectSigningIdentity: Unknown char
Error building target _DetectSigningIdentity: System.FormatException: Unknown char
at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in :0
at System.Single.Parse (System.String s, IFormatProvider provider) [0x00000] in :0
at Microsoft.Build.BuildEngine.ConditionFactorExpression.NumberEvaluate (Microsoft.Build.BuildEngine.Project context) [0x00000] in :0
at Microsoft.Build.BuildEngine.ConditionRelationalExpression.BoolEvaluate (Microsoft.Build.BuildEngine.Project context) [0x00000] in :0
at Microsoft.Build.BuildEngine.ConditionAndExpression.BoolEvaluate (Microsoft.Build.BuildEngine.Project context) [0x00000] in :0
at Microsoft.Build.BuildEngine.ConditionParser.ParseAndEvaluate (System.String condition, Microsoft.Build.BuildEngine.Project context) [0x00000] in :0
at Microsoft.Build.BuildEngine.TaskBatchingImpl.Execute (IBuildTask buildTask, TaskExecutionMode taskExecutionMode) [0x00000] in :0
at Microsoft.Build.BuildEngine.TaskBatchingImpl.Build (IBuildTask buildTask, TaskExecutionMode taskExecutionMode, System.Boolean& executeOnErrors) [0x00000] in :0
at Microsoft.Build.BuildEngine.TargetBatchingImpl.RunTargetWithBucket (System.Collections.Generic.Dictionary`2 bucket, Microsoft.Build.BuildEngine.Target target, System.Boolean& executeOnErrors) [0x00000] in :0
at Microsoft.Build.BuildEngine.TargetBatchingImpl.Run (Microsoft.Build.BuildEngine.Target target, System.Boolean& executeOnErrors) [0x00000] in :0
at Microsoft.Build.BuildEngine.TargetBatchingImpl.Build (Microsoft.Build.BuildEngine.Target target, System.Boolean& executeOnErrors) [0x00000] in :0
at Microsoft.Build.BuildEngine.Target.DoBuild (System.Boolean& executeOnErrors) [0x00000] in :0

Access to the path "/etc/mono/registry" is denied

When I run my ASP.NET MVC 4 website on my Fedora 20 workstation with xsp4 (from MonoDevelop or directly) I'm getting the following exception:
System.Web.HttpRuntime.FinishWithException (wr={Mono.WebServer.XSPWorkerRequest}, e={System.Web.HttpException: ---> System.Web.HttpException: The pre-application start initialization method Start on type System.Web.WebPages.PreApplicationStartCode threw an exception with the following error message: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for <Module> ---> System.Security.SecurityException: No access to the given key ---> System.UnauthorizedAccessException: Access to the path "/etc/mono/registry" is denied.
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00064] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:113
at System.IO.Directory.CreateDirectory (System.String path) [0x000a4] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:80
at System.IO.DirectoryInfo.Create () [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/DirectoryInfo.cs:141
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00039] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:98
at System.IO.Directory.CreateDirectory (System.String path) [0x000a4] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.IO/Directory.cs:80
at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile) [0x0004a] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:136
--- End of inner exception stack trace ---
at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile) [0x00057] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:138
at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:116
at Microsoft.Win32.KeyHandler.Lookup (Microsoft.Win32.RegistryKey rkey, Boolean createNonExisting) [0x000cc] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:412
at Microsoft.Win32.UnixRegistryApi.OpenSubKey (Microsoft.Win32.RegistryKey rkey, System.String keyname, Boolean writable) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs:836
at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name, Boolean writable) [0x0001e] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/RegistryKey.cs:278
at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/Microsoft.Win32/RegistryKey.cs:262
at (wrapper remoting-invoke-with-check) Microsoft.Win32.RegistryKey:OpenSubKey (string)
at Microsoft.Web.Infrastructure.RegistryKeyWrapper.OpenSubKey (System.String name) [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.KillBitHelper.GetKillBittedVersions () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.KillBitHelper.IsThisAssemblyKillBitted () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.KillBitHelper.ThrowIfKillBitIsSet () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.ModuleInitializer+CriticalInitializer.CheckKillBit () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.ModuleInitializer+CriticalInitializer.Initialize () [0x00000] in <filename unknown>:0
at Microsoft.Web.Infrastructure.ModuleInitializer.Initialize () [0x00000] in <filename unknown>:0
at <Module>..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Web.WebPages.PreApplicationStartCode.Start () [0x0002b] in /builddir/build/BUILD/mono-3.4.0/external/aspnetwebstack/src/System.Web.WebPages/PreApplicationStartCode.cs:40
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00069] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:238
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MethodBase.cs:114
at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x0004f] in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:561
--- End of inner exception stack trace ---
at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x0007e] in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:564
at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00059] in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs:408
--- End of inner exception stack trace ---}) in /builddir/build/BUILD/mono-3.4.0/mcs/class/System.Web/System.Web/HttpRuntime.cs:674
I've checked it and there is no registry file or folder in /etc/mono/. I also can't find it in any subfolder, how can I resolve this question?
I'm running Fedora 20 with the latest 3.15.6 kernel
$ mono --version
Mono JIT compiler version 3.4.0 (tarball Fri Jun 27 17:26:36 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
$ xsp4 --version
xsp4.exe 3.0.0.0
Copyright (C) 2002-2011 Novell, Inc.
Minimalistic web server for testing System.Web
I have another setup in Ubuntu 14.04 LTS and that one works, so it might be something with the mono version, or maybe I'm missing some library?
Turns out simply creating the folder using mkdir
sudo mkdir /etc/mono/registry
and setting the right permissions using chmod
sudo chmod uog+rw /etc/mono/registry
does the trick.
However I still don't understand where such a folder is hidden in Ubuntu and why it doesn't need to be created there, as well as why it isn't created automatically during the installation.
You can set MONO_REGISTRY_PATH to point to a directory that you control:
bash
mkdir my-registry
MONO_REGISTRY_PATH=`pwd`/my-registry
xsp4

Is it MonoDevelop's bug?

I use Debian Squeeze and MonoDevelop 2.4 for my program and I have some problems with it. When I trying to save my project's changes, I have next message dialog of MonoDevelop:
System.NullReferenceException: Object reference not set to an instance of an object
at MonoDevelop.GtkCore.GuiBuilder.CodeBinder.IsValidClass (MonoDevelop.Projects.Dom.Parser.ProjectDom ctx, IType cls, Stetic.Component obj) [0x00000] in :0
at MonoDevelop.GtkCore.GuiBuilder.CodeBinder.GetClass (Boolean getUserClass) [0x00000] in :0
at MonoDevelop.GtkCore.GuiBuilder.CodeBinder.GetClass () [0x00000] in :0
at MonoDevelop.GtkCore.GuiBuilder.CodeBinder.UpdateBindings (System.String fileName) [0x00000] in :0
at MonoDevelop.GtkCore.GuiBuilder.GuiBuilderView.Save (System.String fileName) [0x00000] in :0
at MonoDevelop.Ide.Gui.Document.Save () [0x00000] in :0
at MonoDevelop.Ide.Gui.Workbench.SaveAll () [0x00000] in :0
at MonoDevelop.Ide.Commands.SaveAllHandler.Run () [0x00000] in :0
at MonoDevelop.Components.Commands.CommandHandler.Run (System.Object dataItem) [0x00000] in :0
at MonoDevelop.Components.Commands.CommandHandler.InternalRun (System.Object dataItem) [0x00000] in :0
at MonoDevelop.Components.Commands.CommandManager.DefaultDispatchCommand (MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info, System.Object dataItem, System.Object target, CommandSource source) [0x00000] in :0
at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x00000] in :0
When I trying to add some event for my project's form, I have the same. What does it mean and how can I fix this problem?
You should try to use latest Mono and latest MonoDevelop,
http://pkg-mono.alioth.debian.org/ (3.0.6)
http://monodevelop.com/Download (4.0.8)
MonoDevelop 2.4.* was two years ago,
http://monodevelop.com/Download/MonoDevelop_2.4.2_Released?highlight=2.4+release+notes

NHibernate ISession.Query<T> in Mono/NUnit throwing exception

I'm attempting to get my first NHibernate project up and running in Mono/openSUSE 11.4. My unit tests are working successfully under Windows but when I attempt to run the same tests on Mono I'm getting an exception when I try to get back the Query object from my NHibernate session.
Saving data through NHibernate seems to be working correctly.
I'm using Mono 2.10.2 and NUnit version 2.4.8 with Fluent NHibernate 1.2 for NHibernate 3.1.
I've included the full output from nunit-console just in case:
>NUnit version 2.4.8
>Copyright (C) 2002-2007 Charlie Poole.
>Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
>Copyright (C) 2000-2002 Philip Craig.
>All Rights Reserved.
>
>Runtime Environment -
>OS Version: Unix 2.6.37.1
>CLR Version: 4.0.30319.1 ( 2.10.2 (tarball Mon Apr 18 15:12:52 UTC 2011) )
>
>.F
>Tests run: 1, Failures: 1, Not run: 0, Time: 1.563 seconds
>
>Test Case Failures:
>1) MyTests.MyTest : System.TypeInitializationException : An exception was thrown by the type initializer for NHibernate.Linq.NhRelinqQueryParser
>----> System.Reflection.ReflectionTypeLoadException : The classes in the module cannot be loaded.
>at NHibernate.Linq.NhLinqExpression.Translate (ISessionFactoryImplementor sessionFactory) [0x00000] in <filename unknown>:0
>at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators (System.String queryIdentifier, IQueryExpression queryExpression, System.String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) [0x00000] in <filename unknown>:0
>at NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators (System.String expressionStr, IQueryExpression queryExpression, System.String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) [0x00000] in <filename unknown>:0
>at NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor (System.String expressionStr, IQueryExpression queryExpression, System.String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) [0x00000] in <filename unknown>:0
>at NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor (System.String expressionStr, IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) [0x00000] in <filename unknown>:0
>at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan (IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters) [0x00000] in <filename unknown>:0
>at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan (IQueryExpression queryExpression, Boolean shallow) [0x00000] in <filename unknown>:0
>at NHibernate.Impl.AbstractSessionImpl.CreateQuery (IQueryExpression queryExpression) [0x00000] in <filename unknown>:0
>at NHibernate.Linq.NhQueryProvider.PrepareQuery (System.Linq.Expressions.Expression expression, IQuery& query, NHibernate.Linq.NhLinqExpression& nhQuery) [0x00000] in <filename unknown>:0
>at NHibernate.Linq.NhQueryProvider.Execute (System.Linq.Expressions.Expression expression) [0x00000] in <filename unknown>:0
>at NHibernate.Linq.NhQueryProvider.Execute[IEnumerable`1] (System.Linq.Expressions.Expression expression) [0x00000] in <filename unknown>:0
>at Remotion.Data.Linq.QueryableBase`1[MyProject.Entities.Email].GetEnumerator () [0x00000] in <filename unknown>:0
>at System.Collections.Generic.List`1[MyProject.Entities.Email].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in /usr/src/packages/BUILD/mono-2.10.2/mcs/class/corlib/System.Collections.Generic/List.cs:126
>at System.Collections.Generic.List`1[MyProject.Entities.Email]..ctor (IEnumerable`1 collection) [0x0002f] in /usr/src/packages/BUILD/mono-2.10.2/mcs/class/corlib/System.Collections.Generic/List.cs:63
>at System.Linq.Enumerable.ToList[Email] (IEnumerable`1 source) [0x00006] in /usr/src/packages/BUILD/mono-2.10.2/mcs/class/System.Core/System.Linq/Enumerable.cs:2847
>at MyTests.MyTest () [0x0000c] in /tmp/source/MyTests/MyTest.cs:125
>at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
>at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /usr/src/packages/BUILD/mono-2.10.2/mcs/class/corlib/System.Reflection/MonoMethod.cs:226
>--ReflectionTypeLoadException
>at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
>at System.Reflection.Assembly.GetTypes () [0x00000] in /usr/src/packages/BUILD/mono-2.10.2/mcs/class/corlib/System.Reflection/Assembly.cs:346
>at Remotion.Data.Linq.Parsing.Structure.ExpressionTreeParser.CreateDefaultNodeTypeProvider () [0x00000] in <filename unknown>:0
>at NHibernate.Linq.NHibernateNodeTypeProvider..ctor () [0x00000] in <filename unknown>:0
>at NHibernate.Linq.NhRelinqQueryParser..cctor () [0x00000] in <filename unknown>:0
Following AlexCuse's advice I ran monodis against the DLLs. All of the NHibernate dlls are set to CopyLocal. They seem to be happy with monodis. NHibernate.dll doesn't however. Here is the end of the output:
class NHibernate.Context.WcfStateExtension V_0)
IL_0000: call Missing method get_Current in assembly
/tmp/source/MyTests/NHibernate.dll, type
System.ServiceModel.OperationContext
[System.ServiceModel]System.ServiceModel.OperationContext::get_Current()
IL_0005: callvirt Missing method get_Extensions in assembly
/tmp/source/MyTests/NHibernate.dll, type
System.ServiceModel.OperationContext instance <>
[System.ServiceModel]System.ServiceModel.OperationContext::get_Extensions()
IL_000a: callvirt Missing method Find in assembly
/tmp/source/MyTests/NHibernate.dll, type Typespec 0x1b00017e Missing
method Find in assembly /tmp/source/MyTests/NHibernate.dll, type
Typespec 0x1b00017e
* Assertion at get.c:2097, condition `mh' not met
Aborted
mono -v
Mono JIT compiler version 2.10.2 (tarball Mon Apr 18 15:12:52 UTC 2011)
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: debugger softdebug
LLVM: yes(2.9svn-mono)
GC: Included Boehm (with typed GC and Parallel Mark)
I gave up and installed Fluent NHibernate 1.1 with NHibernate.Linq-2.1.2-GA. All seems to be happy in the world of my unit tests but I'm still trying to figure out what is going so wrong with the current version.
I rolled back to use NHibernate 2.1.2 with the additional Linq library which worked fine but then I revisited this the other day I found the fix was ridiculously simple.
The mono-wcf package was not installed on my system. NHibernate 3.2 requires WCF. Now I've installed it, it is all working perfectly!
Are all of your libraries referenced with "CopyLocal" set to true? If so, running
/path/to/mono/monodis <DLLNAME>
on your bin directory may help to determine if they are valid assemblies: (http://comments.gmane.org/gmane.comp.gnome.mono.aspnet/1106)
I've seen this (on older versions of mono AND fluent NHibernate) when dealing with classes that were not CLS-compliant, but in that case it was able to load the assembly to use other classes (I was not loading with reflection though).