I'm hosting a Web API in IIS (7.5) as an Application under "Default Web Site", and am using several of the Enrichers from Serilog.Extras.Web (I'll be upgrading soon to the SerilogWeb.Classic package). I noticed in my logs that ApplicationLifecycleModule.LogRequest() was being called twice for each request, and I'm trying to understand why.
What I noticed is that ApplicationLifecycleModule.Init() is being called twice, thus registering two event handlers.
The first callstack:
Serilog.Extras.Web.dll!Serilog.Extras.Web.ApplicationLifecycleModule.Init(System.Web.HttpApplication context)
System.Web.dll!System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(System.IntPtr appContext, System.Web.HttpContext context, System.Reflection.MethodInfo[] handlers)
System.Web.dll!System.Web.HttpApplication.InitSpecial(System.Web.HttpApplicationState state, System.Reflection.MethodInfo[] handlers, System.IntPtr appContext, System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(System.IntPtr appContext, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.InitializeApplication(System.IntPtr appContext)
[AppDomain Transition]
And the second:
Serilog.Extras.Web.dll!Serilog.Extras.Web.ApplicationLifecycleModule.Init(System.Web.HttpApplication context)
System.Web.dll!System.Web.HttpApplication.InitModulesCommon()
System.Web.dll!System.Web.HttpApplication.InitInternal(System.Web.HttpContext context, System.Web.HttpApplicationState state, System.Reflection.MethodInfo[] handlers)
System.Web.dll!System.Web.HttpApplicationFactory.GetNormalApplicationInstance(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplicationFactory.GetApplicationInstance(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
Am I doing something wrong? Or is this a bug in the ApplicationLifecycleModule?
Related
i attempt to migrate bot framework composer dot net 3.1 project to dot net 6
upon testing i hit Internet Service Error, any insight would be appreciated.
ArgumentNullException: Value cannot be null. (Parameter 'adaptiveDialogId')
Microsoft.Bot.Builder.Dialogs.Adaptive.AdaptiveDialogBot..ctor(string adaptiveDialogId, string languageGeneratorId, ResourceExplorer resourceExplorer, ConversationState conversationState, UserState userState, SkillConversationIdFactoryBase skillConversationIdFactoryBase, LanguagePolicy languagePolicy, BotFrameworkAuthentication botFrameworkAuthentication, IBotTelemetryClient telemetryClient, IEnumerable scopes, IEnumerable pathResolvers, IEnumerable dialogs, ILogger logger)
Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.ConfigurationAdaptiveDialogBot..ctor(IConfiguration configuration, ResourceExplorer resourceExplorer, ConversationState conversationState, UserState userState, SkillConversationIdFactoryBase skillConversationIdFactoryBase, LanguagePolicy languagePolicy, BotFrameworkAuthentication botFrameworkAuthentication, IBotTelemetryClient telemetryClient, IEnumerable scopes, IEnumerable pathResolvers, IEnumerable dialogs, ILogger logger)
System.RuntimeMethodHandle.InvokeMethod(object target, ref Span arguments, Signature sig, bool constructor, bool wrapExceptions)
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<TArgument, TResult>.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<TArgument, TResult>.VisitCallSite(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)
System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, bool isDefaultParameterRequired)
lambda_method8(Closure , IServiceProvider , object[] )
Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider+<>c__DisplayClass7_0.b__0(ControllerContext controllerContext)
Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider+<>c__DisplayClass6_0.g__CreateController|0(ControllerContext controllerContext)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Thanks AP01 for dropping your knowledge
Unfortunately, the adaptiveDialogId is embedded in library Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime in which I cannot debug
however, inspired by your advice
I modify the build target not from scratch, but simply upgrade the dot net target straight from 3.1 to 6
as it turns out the problems caused by nullable validation in the Project File, this causes dot net 3.1 libraries not working
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64</Platforms>
**<Nullable>enable</Nullable>**
...
</PropertyGroup>
I have a xamarin forms switch , when it is toggled getting the following exception on ios version only:
{System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.SwitchRenderer.OnElementToggled (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\SwitchRenderer.cs:78
at (wrapper delegate-invoke) System.EventHandler`1[Xamarin.Forms.ToggledEventArgs].invoke_void_object_TEventArgs(object,Xamarin.Forms.ToggledEventArgs)
at Xamarin.Forms.Switch+<>c.<.cctor>b__21_0 (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Switch.cs:14
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:343
at Xamarin.Forms.Element.SetValueFromRenderer (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:250
at Xamarin.Forms.Element.Xamarin.Forms.IElementController.SetValueFromRenderer (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:246
at Xamarin.Forms.Platform.iOS.SwitchRenderer.OnControlValueChanged (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\SwitchRenderer.cs:73
at UIKit.UIControlEventProxy.Activated () [0x00004] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIControl.cs:38
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at WeCareMobility.iOS.Application.Main (System.String[] args) [0x00002] in /Users/user/Desktop/Vipin/Copiloto/Mobile/WeCareMobility/WeCareMobility.iOS/Main.cs:20 }
Xaml:
<Switch Grid.Row="0" Grid.Column="1" Margin="{OnPlatform Android='0,0,25,0',iOS='0,0,0,8'}" Scale="{OnPlatform iOS= '0.7'}" VerticalOptions="Start" HorizontalOptions="FillAndExpand" IsToggled="False" Toggled="Switch_Toggled" />
CS:
private void Switch_Toggled(object sender, ToggledEventArgs e)
{
// Perform an action after examining e.Value
if (e.Value)
{
App.Current.MainPage = new NavigationPage(new FlyoutPage());
_weCareStorageService.SetToggleValue(true);
}
}
I do not have any renderer for switch. It is working fine for android.
Upgraded to latest xamarin forms stable version 4.7.0.1080.
Using VS2019 mac. iOS sdk version:13.18.2.1 .
Cleaned,rebuilt. Still crash occurs in ios. Need some help...
Navigation was the issue.Changed navigation like this:
Device.BeginInvokeOnMainThread(() => { App.Current.MainPage = new NavigationPage(new FlyoutPage()); });
Solved issue.
When I scaffold this Oracle DB (database -first) and it generates me all models, contexts, FK relations ect. But it gives me an error in the context when I start Querying.
(simple things as select * from (any Table))
The follow error comes up.
System.InvalidOperationException
HResult=0x80131509
Message=The properties 'Address.AddressId', 'Address.AddressItemId'
are configured to use 'Identity' value generator and are mapped to the
same table '[DBName].ADDRESS'. Only one column per table can be
configured as 'Identity'. Call 'ValueGeneratedNever' for properties
that should not use 'Identity'.
Source=Oracle.EntityFrameworkCore
StackTrace:
at
Oracle.EntityFrameworkCore.Internal.OracleModelValidator.ValidateSharedColumnsCompatibility(IReadOnlyList`1
mappedTypes, String tableName)
at
Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelValidator.ValidateSharedTableCompatibility(IModel
model)
at
Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelValidator.Validate(IModel
model)
at
Oracle.EntityFrameworkCore.Internal.OracleModelValidator.Validate(IModel
model)
at
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ValidatingConvention.Apply(InternalModelBuilder
modelBuilder)
at
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnModelBuilt(InternalModelBuilder
modelBuilder)
at
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnModelBuilt(InternalModelBuilder
modelBuilder)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.Validate()
at Microsoft.EntityFrameworkCore.ModelBuilder.FinalizeModel()
at
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext
context, IConventionSetBuilder conventionSetBuilder, IModelValidator
validator)
at
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.b__1()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper
executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext
context, IConventionSetBuilder conventionSetBuilder, IModelValidator
validator)
at
Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
at
Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
at
Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.b__7_2(IServiceProvider
p)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
constructorCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite
callSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope
scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type
serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type
serviceType)
at
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider, Type serviceType)
at
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider
provider)
at
Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at
Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at
Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_Model()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.get_EntityType()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.CheckState()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.get_EntityQueryable()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at OracleConsoleApp.Program.Main(String[] args) in
C:\GitPlayGround\OracleConsoleApp\OracleConsoleApp\Program.cs:line 47
I need to use the FK connections in this complex structure.
I have no experience with Oracle, nor with Oracle.EntityFrameworkCore (2.2.6, application core 2.2)
Can anyone advise me what to do, Can't find a clue to start to solve this.
After a deep research, my colleague came with the solution.
In Oracle generated value's work different. With the database first it sets the data annotation ValueGeneratedOnAdd();.
This is not a working model and context.
So selective deleting this ValueGeneratedOnAdd() will result in a working result and solves the problem.
I have recently upgraded my project from dotnet core v.1.0.0 to v.1.0.4. I am using the same code in each of the Startup.cs files. V.1.0.0 works fine, .4 does not. Visual Studio 2017.
System.ArgumentNullException occurred
HResult=0x80004003
Message=Value cannot be null.
Source=<Cannot evaluate the exception source>
StackTrace:
at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
at Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseSqlServer(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 sqlServerOptionsAction)
at ApostilleDNCv2.Startup.<ConfigureServices>b__4_0(DbContextOptionsBuilder options) in c:\users\kenn.kinnaird\documents\visual studio 2017\Projects\ApostilleDNCv2\ApostilleDNCv2\Startup.cs:line 34
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.DbContextOptionsFactory[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at Microsoft.AspNetCore.Mvc.Internal.TypeActivatorCache.CreateInstance[TInstance](IServiceProvider serviceProvider, Type implementationType)
at Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory.CreateController(ControllerContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
My code (both version):
Startup.cs-
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("ApostillesTest")));
services.AddMvc();
services.AddDistributedMemoryCache();
services.AddScoped<ICountryRepository, CountryRepository>();
appsettings.json-
"ConnectionStrings": {
"ApostillesTest": "Server=TESTSQLCORP;Database=Apostilles;Trusted_Connection=True;Persist Security Info=True",
"DefaultConnection": "Server=TESTSQLCORP;Database=Apostilles;Trusted_Connection=True"
}
I have looked at other solutions here; none have helped.
Any help will be appreciated.
I'm developing an application using RavenDB. I have automated tests that work against an embedded in-memory database. All tests were working fine when I was referencing Raven build 2033-Unstable. I upgraded to build 2067-Unstable (and now 2069) and am now getting an exception in every NUnit test when run via TeamCity (7.1 build 23907). All tests run fine when run via R# or NUnit GUI.
The exception I'm receiving appears to be a NullReferenceException inside Raven 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. I'm not even using the Versioning bundle.
Here's the full stack trace :
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)
I'm using Autofac to wire it up, and that code looks like this:
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)));
}
}
Solved. Setting the PluginsDirectory to be the same folder as all the other DLLs, particularly Raven.Database.dll, was causing all the plugins embedded in that DLL be be unintentionally loaded as well. Not all of the Raven plugins work together, so loading them all caused exceptions. By making a separate Plugins directory, and copying Raven.Bundles.UniqueConstraints.dll into that made the exception stop happening.
I still don't understand why it only failed from the build server; it seems like it should have failed locally as well.