Metro Application (WinRT 8.1) using Mvvmhelpers from nuget + SQLite causes Exception

Oct 6, 2013 at 6:57 PM

I'm using Mvvmhelpers and I'm quite happy until now ! Thanks for your work.

But I have a problem using Mvvmhelpers with SQLite (using VS2013 Express Preview). Creating my ViewModel using Xaml or CodeBehind causes an error :
System.AggregateException in mscorlib.dll

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at JulMar.Core.Services.DynamicComposer.get_Host()
   at JulMar.Core.Services.DynamicComposer.TryGetExportedValue(Type type, Object& value)
   at JulMar.Core.Services.Internal.ServiceProvider.CheckLocatedServices(Type type, Object& value)
   at JulMar.Core.Services.Internal.ServiceProvider.DynamicLoadAndAdd(Type serviceType)
   at JulMar.Core.Services.Internal.ServiceProvider.GetService(Type serviceType)
   at JulMar.Core.Services.Internal.ServiceProvider.Resolve[T]()
It seems to be related to the loading of available assemblies in the DynamicComposer.
It is easy to reproduce, just create a project, add MvvmHelpers, add Sqlite (+ C++ Runtime) and associate a ViewModel to a Xaml page; you'll get the error.

Thanks for your help !
Oct 7, 2013 at 12:43 PM
Let me check it out, my guess is there are some exports or something there which are conflicting - I'll get back to you shortly!


Oct 14, 2013 at 7:52 PM
Which SQLite package are you installing? Please let me know the version number and x86/x64..

Oct 14, 2013 at 7:53 PM
Also, did you use nuget to grab MVVMHelpers? There's a newer version available than what's on Nuget that specifically targets 8.1 - that's what I'm trying this with but I've not packaged it up yet..

Oct 16, 2013 at 5:25 PM
I'm using the latest package available from SQLite (sqlite-winrt81-3080002.vsix) and I took MVVMHelpers from nuget (version 2013.1.09.00 published on 24-05-13).
I manage to make it work by excluding SQLite loading in the DynamicComposer class (the same way you exclude your own package).
Dec 3, 2013 at 2:34 PM
Just to close this out, the next release will correct this issue. The problem stems from the native assets added into the project which cannot be loaded properly by MEF - so it throws an exception. I now exclude any non-managed image from the scan. Thanks for reporting this!