-
Setup project et SQLite
Bonjour,
Je suis actuellement en train de développer une application WPF avec C#. Pour certaines raisons j'ai choisi une base de données SQLite.
Cela fonctionne parfaitement en Debug, ainsi qu'en Release.
Je fais alors un projet Setup pour déployer l'application (avec un .msi).
Le problème est que quand lance l'application sur un poste, j'ai une erreur à cause de ma base de données.
Voici la stack :
Une exception a été levée par la cible d'un appel.
à System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, Boolean& domainInitialized)
à System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj)
à System.Reflection.RtFieldInfo.InternalGetValue(Object obj, StackCrawlMark& stackMark)
à System.Reflection.RtFieldInfo.GetValue(Object obj)
à System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
à System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
à System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetService(Type type, Object key, Func`3 handleFailedLookup)
à System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetService(Type type, Object key)
à System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 k)
à System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
à System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.GetService(Type type, Object key)
à System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
à System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
à System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
à System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
à System.Data.Entity.Infrastructure.DependencyResolution.RootDependencyResolver.GetService(Type type, Object key)
à System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
à System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
à System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
à System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
à System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)
à System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)
à System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String providerInvariantName)
à System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)
à System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)
à System.Data.Entity.Internal.LazyInternalConnection.Initialize()
à System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
à System.Data.Entity.Internal.LazyInternalContext.get_ProviderName()
à System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)
à System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
à System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
à System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
à System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
à System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
à System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector)
à Cubbyhole.Services.DirectoryServices.GetAll()
à Cubbyhole.Controller.ApplicationController.<LoadDatas>b__79(Object WaitCallback)
D'avance merci
-
Bon pas de réponses, mais j'ai résolu mon problème. Il s'agissait d'un problème de référence avec les librairies Interop pour SQLite et un problème de compatibilité entre les plateformes (x86 et x64).
Pour ceux qui auraient un jour ce genre de soucis, j'ai aussi du décocher "Préférer 32bits" dans la section "Général" de l'onglet "Générer" des propriétés du projet.
Je me demande par ailleurs, pourquoi certaines choses fonctionnent parfaitement sous Visual Studio (même en mode release) mais ne fonctionnent plus une fois le setup déployé... Par exemple j'ai eu un problème parce qu'un thread contenait un autre thread dans une méthode sous jacente, alors que cela ne posait pas de soucis sous VS...
Bref, je marque ce sujet comme résolu !