Two UsesReflectonOptimizer tests build in release mode are now failing on newer Windows and/or .NET frameworks.

Description

When running tests from release optimized assemblies (not debug), two tests are failing where the stack (when debugging in Visual Studio 2017) now says [Lightweight Functions]. Looking at just the StackTrace structure, it's not clear how Visual Studio determines that it's a lightweight function.

This is the case at least with Windows 10 (1703) and Windows Server 2016 with Visual Studio 2017 installed. Both with .NET 4.7 Framework and recent security/feature updates installed.

I've tested with several versions on the master branch and all the way back to the 4.1.1.GA tag.

For some reason, the TeamCity build server in release mode isn't failing on these tests. It may be something to do with .NET 4.7 installed or with the version of Windows.

1) Failed : NHibernate.Test.NHSpecificTest.NH3119.ByCodeFixture.PocoComponentTuplizer_Instantiate_UsesReflectonOptimizer
Expected: String containing "NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateInstance"
But was: " at NHibernate.Test.NHSpecificTest.NH3119.Component..ctor()
at ()
at NHibernate.Type.ComponentType.Instantiate(Object parent, ISessionImplementor session)
at NHibernate.Type.ComponentType.ResolveIdentifier(Object value, ISessionImplementor session, Object owner)
at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, Boolean readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, PostLoadEvent postLoadEvent)
at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean readOnly)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
at NHibernate.Impl.AbstractQueryImpl2.List()
at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
at NHibernate.Test.NHSpecificTest.NH3119.ByCodeFixture.PocoComponentTuplizer_Instantiate_UsesReflectonOptimizer()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at NUnit.Framework.Internal.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.TestActionCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.SetUpTearDownCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
"
at NHibernate.Test.NHSpecificTest.NH3119.ByCodeFixture.PocoComponentTuplizer_Instantiate_UsesReflectonOptimizer()

2) Failed : NHibernate.Test.NHSpecificTest.NH3119.ByCodeFixture.PocoComponentTuplizerOfDeserializedConfiguration_Instantiate_UsesReflectonOptimizer
Expected: String containing "NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateInstance"
But was: " at NHibernate.Test.NHSpecificTest.NH3119.Component..ctor()
at ()
at NHibernate.Type.ComponentType.Instantiate(Object parent, ISessionImplementor session)
at NHibernate.Type.ComponentType.ResolveIdentifier(Object value, ISessionImplementor session, Object owner)
at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, Boolean readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, PostLoadEvent postLoadEvent)
at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean readOnly)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
at NHibernate.Impl.AbstractQueryImpl2.List()
at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
at NHibernate.Test.NHSpecificTest.NH3119.ByCodeFixture.PocoComponentTuplizerOfDeserializedConfiguration_Instantiate_UsesReflectonOptimizer()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at NUnit.Framework.Internal.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.TestActionCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.SetUpTearDownCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
"
at NHibernate.Test.NHSpecificTest.NH3119.ByCodeFixture.PocoComponentTuplizerOfDeserializedConfiguration_Instantiate_UsesReflectonOptimizer()

Environment

Windows 10, Server 2016.

Status

Assignee

Unassigned

Reporter

Nathan Brown

Labels

None

Components

Affects versions

4.1.1
5.0.0

Priority

Trivial
Configure