While we have no solution as yet, we've hit the same issue on our
project in the same circumstances.

The problem (thanks @xtoff) would appear to be that the
ExpressionTransformerRegistry is trying to get the CLR version via
something like:

  GetReferencedAssemblies().Where(a => a.Name == "mscorlib").Single()

For some reason multiple "mscorlib"s appear in this list when running
under MSTest. It's hard to say whether this is an NHibernate
(ILMerge?) problem or an MSTest oddity.

Cheers,
Nick


On Mar 22, 1:06 am, ESwann <rico.sw...@gmail.com> wrote:
> I've just upgraded a project ot 3.1 and began getting failures on
> several integration tests.  The errors only occur when I run the tests
> in MSTest.  If I debug the tests in MSTest or run them in the
> Resharper runner, no issues.  Unfortunatley because our build
> mechanism is TFS, MSTest is our standard runner when performing builds
> and changing this is not an option at this point.  Looks like the
> Remotion parser itself thinks there is some duplicate entry when
> trying to parse the LINQ query.  Again, this only happens when the
> situation above is met.  This did not occur in NH 3.0.  Any ideas
> would be appreciated.
>
> The exception I see is:
>
> Test method
> Fsc.DataServices.Tests.Integration.ServiceFixtures.ProcedureContractDataServiceFixture.GetProcedureContracts_ShouldReturnRecords_WithValidStationId_WithValidProcedure_WithValidContractDateOf20110903
> threw exception:
> System.TypeInitializationException: The type initializer for
> 'NHibernate.Linq.NhRelinqQueryParser' threw an exception. --->
> System.InvalidOperationException: Sequence contains more than one
> matching element
>
> And the stack trace is:
>
> System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2
> predicate)
> Remotion.Data.Linq.Parsing.ExpressionTreeVisitors.Transformation.ExpressionTransformerRegistry.CreateDefault()
> NHibernate.Linq.NhRelinqQueryParser..cctor() in d:\CSharp\NH\NH
> \nhibernate\src\NHibernate\Linq\NhRelinqQueryParser.cs: line 26
> NHibernate.Linq.NhRelinqQueryParser.Parse(Expression expression)
> NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor
> sessionFactory) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Linq
> \NhLinqExpression.cs: line 65
> NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String
> queryIdentifier, IQueryExpression queryExpression, String
> collectionRole, Boolean shallow, IDictionary`2 filters,
> ISessionFactoryImplementor factory) in d:\CSharp\NH\NH\nhibernate\src
> \NHibernate\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs: line 27
> NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators(String
> expressionStr, IQueryExpression queryExpression, String
> collectionRole, Boolean shallow, IDictionary`2 enabledFilters,
> ISessionFactoryImplementor factory) in d:\CSharp\NH\NH\nhibernate\src
> \NHibernate\Engine\Query\HQLExpressionQueryPlan.cs: line 34
> NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String
> expressionStr, IQueryExpression queryExpression, String
> collectionRole, Boolean shallow, IDictionary`2 enabledFilters,
> ISessionFactoryImplementor factory) in d:\CSharp\NH\NH\nhibernate\src
> \NHibernate\Engine\Query\HQLExpressionQueryPlan.cs: line 23
> NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String
> expressionStr, IQueryExpression queryExpression, Boolean shallow,
> IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in d:
> \CSharp\NH\NH\nhibernate\src\NHibernate\Engine\Query
> \HQLExpressionQueryPlan.cs: line 17
> NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression
> queryExpression, Boolean shallow, IDictionary`2 enabledFilters) in d:
> \CSharp\NH\NH\nhibernate\src\NHibernate\Engine\Query
> \QueryPlanCache.cs: line 88
> NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression
> queryExpression, Boolean shallow) in d:\CSharp\NH\NH\nhibernate\src
> \NHibernate\Impl\AbstractSessionImpl.cs: line 312
> NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression
> queryExpression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
> \AbstractSessionImpl.cs: line 268
> NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression expression,
> IQuery& query, NhLinqExpression& nhQuery) in d:\CSharp\NH\NH\nhibernate
> \src\NHibernate\Linq\NhQueryProvider.cs: line 43
> NHibernate.Linq.NhQueryProvider.Execute(Expression expression) in d:
> \CSharp\NH\NH\nhibernate\src\NHibernate\Linq\NhQueryProvider.cs: line
> 26
> NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression
> expression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Linq
> \NhQueryProvider.cs: line 103
> Remotion.Data.Linq.QueryableBase`1.GetEnumerator()
> System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
> System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
> Fsc.DataServices.Ods.DataAccess.Reference.Services.ReferenceDataService.GetContracts(ContractSearchCriteria
> criteria) in C:\Projects\Fsc\Fsc.DataServices\trunk\src\Main
> \Fsc.DataServices.Ods.DataAccess\Reference\Services
> \ReferenceDataService.cs: line 127
> Fsc.DataServices.Tests.Integration.ServiceFixtures.RasReferralGetContractDataServiceTestFixture.GetContract_ShouldReturnRecords_WithValidStationId()
> in C:\Projects\Fsc\Fsc.DataServices\trunk\src\Tests
> \Fsc.DataServices.Tests.Integration\ServiceFixtures
> \ContractDataServiceFixture.cs: line 37

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com.
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to