Я пытаюсь запустить и запустить мой первый проект NHibernate в Mono / openSUSE 11.4. Мои модульные тесты успешно работают под Windows, но когда я пытаюсь запустить те же тесты на Mono, я получаю исключение, когда пытаюсь вернуть объект Query из моего сеанса NHibernate.
Сохранение данных через NHibernate, похоже, работает правильно.
Я использую Mono 2.10.2 и NUnit версии 2.4.8 с Fluent NHibernate 1.2 для NHibernate 3.1.
Я включил полный вывод из nunit-console на всякий случай:
>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
Следуя советам AlexCuse, я запустил монодис против библиотек DLL. Все библиотеки NHibernate установлены на CopyLocal. Кажется, они счастливы с monodis. NHibernate.dll не однако. Вот конец вывода:
class NHibernate.Context.WcfStateExtension V_0)
IL_0000: call Missing method get_Current in assembly
/ tmp / source / MyTests / NHibernate.dll, введите
System.ServiceModel.OperationContext
[System.ServiceModel] System.ServiceModel.OperationContext :: get_Current ()
IL_0005: callvirt Отсутствует метод get_Extensions в сборке
/tmp/source/MyTests/NHibernate.dll, введите
System.ServiceModel.OperationContext instance <>
[System.ServiceModel] System.ServiceModel.OperationContext :: get_Extensions ()
IL_000a: callvirt Отсутствует метод Найти в сборке
/tmp/source/MyTests/NHibernate.dll, тип Typespec 0x1b00017e Отсутствует
метод Найти в сборке /tmp/source/MyTests/NHibernate.dll, набрать
Typespec 0x1b00017e
* Утверждение в get.c: 2097, условие `mh 'не выполнено
Отменено
моно -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)
Я сдался и установил Fluent NHibernate 1.1 с NHibernate.Linq-2.1.2-GA. Кажется, все счастливы в мире моих юнит-тестов, но я все еще пытаюсь выяснить, что не так с текущей версией.