RavenDBを使用してアプリケーションを開発しています。埋め込まれたインメモリデータベースに対して機能する自動テストがあります。Ravenビルド2033-Unstableを参照していたとき、すべてのテストは正常に機能していました。ビルド2067-Unstable(および現在は2069)にアップグレードしましたが、TeamCity(7.1ビルド23907)を介して実行すると、すべてのNUnitテストで例外が発生します。R#またはNUnit GUIを介して実行すると、すべてのテストが正常に実行されます。
私が受け取っている例外は、NullReferenceException
レイヴンの内部にあるようですRaven.Bundles.Versioning.Triggers.VersioningPutTrigger.AllowPut(String key, RavenJObject document, RavenJObject metadata, TransactionInformation transactionInformation) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Bundles\Versioning\Triggers\VersioningPutTrigger.cs:line 22
。私もVersioning
バンドルを使用していません。
これが完全なスタックトレースです:
Test(s) failed. Autofac.Core.DependencyResolutionException : An exception was thrown while executing a resolve operation. See the InnerException for details.
----> System.NullReferenceException : Object reference not set to an instance of an object.
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters)
at AppCenter.Tests.Fixture.Resolve[TService]() in c:\TeamCity\buildAgent\work\994e66c6c107022f\AppCenter.Tests\Fixture.cs:line 40
at AppCenter.Tests.Fixture.get_Raven() in c:\TeamCity\buildAgent\work\994e66c6c107022f\AppCenter.Tests\Fixture.cs:line 22
at AppCenter.Tests.Fixture.Store[T](T entity) in c:\TeamCity\buildAgent\work\994e66c6c107022f\AppCenter.Tests\Fixture.cs:line 50
at AppCenter.Tests.AppAdmin.ApplicationEditTests.TestLoad() in c:\TeamCity\buildAgent\work\994e66c6c107022f\AppCenter.Tests\AppAdmin\ApplicationEditTests.cs:line 20
--NullReferenceException
at Raven.Bundles.Versioning.Triggers.VersioningPutTrigger.AllowPut(String key, RavenJObject document, RavenJObject metadata, TransactionInformation transactionInformation) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Bundles\Versioning\Triggers\VersioningPutTrigger.cs:line 22
at Raven.Database.DocumentDatabase.<>c__DisplayClass42.<AssertPutOperationNotVetoed>b__3f(AbstractPutTrigger trigger) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 601
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Raven.Database.DocumentDatabase.AssertPutOperationNotVetoed(String key, RavenJObject metadata, RavenJObject document, TransactionInformation transactionInformation) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 600
at Raven.Database.DocumentDatabase.<>c__DisplayClass3a.<Put>b__33(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 551
at Raven.Storage.Managed.TransactionalStorage.ExecuteBatch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Storage\Managed\TransactionalStorage.cs:line 131
at Raven.Storage.Managed.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Storage\Managed\TransactionalStorage.cs:line 112
at Raven.Database.DocumentDatabase.Put(String key, Nullable`1 etag, RavenJObject document, RavenJObject metadata, TransactionInformation transactionInformation) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 543
at Raven.Bundles.Encryption.Settings.EncryptionSettingsManager.VerifyEncryptionKey(DocumentDatabase database, EncryptionSettings settings) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Bundles\Encryption\Settings\EncryptionSettingsManager.cs:line 114
at Raven.Database.Extensions.EnumerableExtensions.Apply[T](IEnumerable`1 self, Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Extensions\EnumerableExtensions.cs:line 18
at Raven.Database.DocumentDatabase.InitializeTriggersExceptIndexCodecs() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 221
at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 200
at Raven.Client.Embedded.EmbeddableDocumentStore.InitializeInternal() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Embedded\EmbeddableDocumentStore.cs:line 208
at Raven.Client.Document.DocumentStore.Initialize() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Lightweight\Document\DocumentStore.cs:line 431
at AppCenter.Config.RavenModule.Initialize(DocumentStoreBase store) in c:\TeamCity\buildAgent\work\994e66c6c107022f\AppCenter.Framework\Config\RavenModule.cs:line 32
at AppCenter.Tests.RavenInMemoryModule.<Load>b__1(IActivatingEventArgs`1 a) in c:\TeamCity\buildAgent\work\994e66c6c107022f\AppCenter.Tests\RavenInMemoryModule.cs:line 25
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass6.<OnActivating>b__5(Object s, ActivatingEventArgs`1 e)
at Autofac.Core.Registration.ComponentRegistration.RaiseActivating(IComponentContext context, IEnumerable`1 parameters, Object& instance)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters)
at AppCenter.Config.RavenModule.<Load>b__1(IComponentContext c) in c:\TeamCity\buildAgent\work\994e66c6c107022f\AppCenter.Framework\Config\RavenModule.cs:line 19
at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
Autofacを使用して配線していますが、そのコードは次のようになります。
protected override void Load(ContainerBuilder builder)
{
builder.Register(c => new EmbeddableDocumentStore
{
RunInMemory = true,
Configuration =
{
PluginsDirectory = GetPluginsDirectory()
}
})
.OnActivating(a => RavenModule.Initialize(a.Instance))
.As<IDocumentStore>()
.Named<IDocumentStore>("test")
.InstancePerLifetimeScope();
}
private static string GetPluginsDirectory()
{
return Path.GetDirectoryName(typeof (UniqueConstraintsPutTrigger).Assembly.Location);
}
public static void Initialize(DocumentStoreBase store)
{
store.RegisterListener(new UniqueConstraintsStoreListener());
store.Initialize();
IndexCreation.CreateIndexes(typeof (RavenModule).Assembly, store);
RequireTrigger(store, typeof (UniqueConstraintsPutTrigger));
}
private static void RequireTrigger(IDocumentStore store, Type triggerType)
{
var installedTriggerNames = store.DatabaseCommands.GetStatistics().Triggers.Select(t => t.Name);
if (!installedTriggerNames.Contains(triggerType.ToString()))
{
throw new Exception(string.Format(
"The required trigger '{0}' was not detected. Verify the bundle '{1}' been installed into the" +
" server's plugins directory.",
triggerType, Path.GetFileName(triggerType.Assembly.Location)));
}
}