mercredi 25 novembre 2015

.NET Native compiled UWP app throws exception

I have an UWP (Windows 10) app which runs perfectly on debug mode (.NET Native disabled).

When I am running it on release mode, (or in debug mode with .NET Native compilation on I receive error on return context.Set().ToList(); line.

    public IEnumerable<TMobileEntity> ReadAll()
    {
        using (var context = new DataContext(database.DatabasePath))
        {
            return context.Set<TMobileEntity>().ToList();
        }
    }

here is an exception details

{System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property. ---> System.PlatformNotSupportedException: TypeHandles are not supported for types that return true for ContainsGenericParameters. at Internal.Reflection.Core.NonPortable.RuntimeType.get_TypeHandle() in f:\dd\ndp\fxcore\src\System.Private.CoreLib\Internal\Reflection\Core\NonPortable\RuntimeType.cs:line 262 at System.Reflection.Runtime.TypeInfos.RuntimeTypeInfo.IsAssignableFrom(TypeInfo typeInfo) in f:\dd\ndp\fxcore\src\System.Private.Reflection.Core\System\Reflection\Runtime\TypeInfos\RuntimeTypeInfo.cs:line 398 at Remotion.Linq.Parsing.Structure.IntermediateModel.SupportedMethodSpecifications.HasIndexSelectorParameter(MethodInfo methodInfo, Int32 parameterPosition) at Remotion.Linq.Parsing.Structure.IntermediateModel.SupportedMethodSpecifications.<>c__DisplayClass14.b__13(MethodInfo mi) at System.Func2.Invoke(T arg) at System.Linq.Enumerable.<>c__DisplayClass01.b__1(TSource x) in f:\dd\ndp\fxcore\Open\src\System.Linq\src\System\Linq\Enumerable.cs:line 69 at System.Func2.Invoke(T arg) at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() in f:\dd\ndp\fxcore\Open\src\System.Linq\src\System\Linq\Enumerable.cs:line 199 at Remotion.Linq.Parsing.Structure.NodeTypeProviders.MethodInfoBasedNodeTypeRegistry.Register(IEnumerable1 methods, Type nodeType) at Remotion.Linq.Parsing.Structure.NodeTypeProviders.MethodInfoBasedNodeTypeRegistry.CreateFromRelinqAssembly() at Microsoft.Data.Entity.Query.QueryCompiler.CreateNodeTypeProvider() at Microsoft.Data.Entity.Query.QueryCompiler..cctor() at System.Runtime.CompilerServices.ClassConstructorRunner.Call[T](IntPtr pfn) at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(Void* returnValue, StaticClassConstructionContext* pContext) in f:\dd\ndp\fxcore\src\System.Private.CoreLib\System\Runtime\CompilerServices\ClassConstructorRunner.cs:line 69 Exception_EndOfInnerExceptionStack at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(Void* returnValue, StaticClassConstructionContext* pContext) in f:\dd\ndp\fxcore\src\System.Private.CoreLib\System\Runtime\CompilerServices\ClassConstructorRunner.cs:line 86 at Microsoft.Data.Entity.Query.QueryCompiler.Preprocess(Expression query, QueryContext queryContext) at Microsoft.Data.Entity.Query.QueryCompiler.Execute[TResult](Expression query) at Microsoft.Data.Entity.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) at Remotion.Linq.QueryableBase1.GetEnumerator() at Microsoft.Data.Entity.Internal.InternalDbSet1.System.Collections.Generic.IEnumerable<TEntity>.GetEnumerator() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) in f:\dd\ndp\fxcore\src\System.Collections\System\Collections\Generic\List.cs:line 88 at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at TIKSN.GroceryChecklist.ModernMobile.Data.RepositoryBase1.ReadAll() in E:\Visual Studio Online\tiksn\Grocery Checklist\Develop\ModernMobile.Data.UWP\RepositoryBase.cs:line 42
at TIKSN.GroceryChecklist.MobileDataService.ChecklistItemsManagementService.<GetCurrentChecklistItems>d__5.MoveNext() in E:\Visual Studio Online\tiksn\Grocery Checklist\Develop\MobileDataService\ChecklistItemsManagementService.cs:line 62 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in f:\dd\ndp\fxcore\src\System.Private.CoreLib\System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs:line 66 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 186 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 155 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 127 at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult() in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 320 at TIKSN.GroceryChecklist.ModernMobile.ViewModels.ChecklistPageViewModel.d__15.MoveNext() in E:\Visual Studio Online\tiksn\Grocery Checklist\Develop\ModernMobile.UWP\ViewModels\ChecklistPageViewModel.cs:line 82 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in f:\dd\ndp\fxcore\src\System.Private.CoreLib\System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs:line 66 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 186 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 155 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 127 at System.Runtime.CompilerServices.TaskAwaiter.GetResult() in f:\dd\ndp\fxcore\src\System.Private.Threading\System\Runtime\CompilerServices\TaskAwaiter.cs:line 112 at TIKSN.GroceryChecklist.ModernMobile.ViewModels.PageViewModelBase.d__46.MoveNext() in E:\Visual Studio Online\tiksn\Grocery Checklist\Develop\ModernMobile.UWP\ViewModels\PageViewModelBase.cs:line 102} System.Exception {System.TypeInitializationException}





Aucun commentaire:

Enregistrer un commentaire