Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9165895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:01:05+00:00 2026-06-17T15:01:05+00:00

In my bootstrapper I start by doing this: public static void Initialise() { var

  • 0

In my bootstrapper I start by doing this:

    public static void Initialise()
    {
        var container = BuildUnityContainer();

        InitializeNServiceBus(container);

        DependencyResolver.SetResolver(new UnityDependencyResolver(container));
        ...
    }

And the content of InitializeNServiceBus is like this:

    private static void InitializeNServiceBus(IUnityContainer container)
    {
        var typesToScan = new [] {
            typeof (RequestPasswordResetCommand),
            typeof (CreateAccountCommand)
        };

        Configure.With(typesToScan)
            .DefineEndpointName("somequeueonmysystem")
            .UnityBuilder(container)
            .XmlSerializer()
            //.MsmqSubscriptionStorage()
            .DisableRavenInstall()
            .DisableSecondLevelRetries() //we need timeout manager for this
            .DisableTimeoutManager() //we need raven db or similar for this //.RunTimeoutManager()
            .MsmqTransport()
                .IsTransactional(false)
                .PurgeOnStartup(false)
            .MsmqSubscriptionStorage()
                .IsTransactional(true)
            .UnicastBus()
                .ImpersonateSender(false)
            .SendOnly();
            //.CreateBus()
            //    .Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install()); 
    }    

However when I open my MVC application I get:

Static property requires null instance, non-static property requires non-null instance.
Parameter name: expression

The source of the error is indicated here:

Line 82: 
Line 83:             Configure.With(typesToScan)
Line 84:                 .DefineEndpointName("InCityS.Events.UI.Nuvonet")
Line 85:                 .UnityBuilder(container)

The stacktrace:

[ArgumentException: Static property requires null instance, non-static property requires non-null instance.
Parameter name: expression]
   System.Linq.Expressions.Expression.Property(Expression expression, PropertyInfo property) +4114402
   NServiceBus.Utils.Reflection.DelegateFactory.Create(PropertyInfo property) in c:\TeamCity\buildAgent\work\nsb.master_2\src\utils\NServiceBus.Utils.Reflection\DelegateFactory.cs:91
   NServiceBus.Serializers.XML.XmlMessageSerializer.InitType(Type t) in c:\TeamCity\buildAgent\work\nsb.master_2\src\impl\Serializers\NServiceBus.Serializers.XML\XmlMessageSerializer.cs:133
   NServiceBus.Serializers.XML.XmlMessageSerializer.InitType(Type t) in c:\TeamCity\buildAgent\work\nsb.master_2\src\impl\Serializers\NServiceBus.Serializers.XML\XmlMessageSerializer.cs:138
   NServiceBus.Serializers.XML.XmlMessageSerializer.Initialize(IEnumerable`1 types) in c:\TeamCity\buildAgent\work\nsb.master_2\src\impl\Serializers\NServiceBus.Serializers.XML\XmlMessageSerializer.cs:948
   NServiceBus.Serializers.XML.Config.MessageTypesInitializer.Run() in c:\TeamCity\buildAgent\work\nsb.master_2\src\impl\Serializers\NServiceBus.Serializers.XML.Config\MessageTypesInitializer.cs:20
   NServiceBus.Configure.<Initialize>b__d(IWantToRunWhenConfigurationIsComplete o) in c:\TeamCity\buildAgent\work\nsb.master_2\src\config\NServiceBus.Config\Configure.cs:305
   System.Collections.Generic.List`1.ForEach(Action`1 action) +10722241
   NServiceBus.Configure.Initialize() in c:\TeamCity\buildAgent\work\nsb.master_2\src\config\NServiceBus.Config\Configure.cs:304
   NServiceBus.Configure.SendOnly() in c:\TeamCity\buildAgent\work\nsb.master_2\src\config\NServiceBus.Config\Configure.cs:364
   InCityS.UI.Open.Bootstrapper.InitializeNServiceBus(IUnityContainer container) in d:\Data_nobackup\Projects\InCityS\trunk\UI\InCityS.UI.Open\Bootstrapper.cs:83
   InCityS.UI.Open.Bootstrapper.Initialise() in d:\Data_nobackup\Projects\InCityS\trunk\UI\InCityS.UI.Open\Bootstrapper.cs:53
   InCityS.UI.Open.MvcApplication.Application_Start() in d:\Data_nobackup\Projects\InCityS\trunk\UI\InCityS.UI.Open\Global.asax.cs:79

[HttpException (0x80004005): Static property requires null instance, non-static property requires non-null instance.
Parameter name: expression]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9859725
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Static property requires null instance, non-static property requires non-null instance.
Parameter name: expression]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

When I changes typesToScan to

var typesToScan = new Type[]{};

the application works again, but of course once I try to put something on the Bus it fails saying it doesn’t know the type through the Scanned Types.

Anyone knows where to look or has experience with this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:01:06+00:00Added an answer on June 17, 2026 at 3:01 pm

    Problem detected.
    One of the messages I added through the types to scan had a property which was op type ‘CultureInfo’ which doesn’t play well with the serialization.

    namespace InCityS.BL.Account.Messages
    {
        public class CreateAccountCommand : ICommand
        {
            public string UserName { get; set; }
            public string Password { get; set; }
    
            public string FirstName { get; set; }
            public string LastName { get; set; }
    
            public CultureInfo Culture { get; set; }
        }
    }
    

    was replaced by:

    namespace InCityS.BL.Account.Messages
    {
        public class CreateAccountCommand : ICommand
        {
            public string UserName { get; set; }
            public string Password { get; set; }
    
            public string FirstName { get; set; }
            public string LastName { get; set; }
    
            public string Culture { get; set; }
        }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up a bootstrapper as follows: private static IUnityContainer BuildUnityContainer() { var
I want to use the SqlExpress2008 Bootstrapper for a new installation on Windows7, I
Trying to solve this problem . I would like to learn how the bootstrapper
I'm working on a WPF project using Prism and MVVM, I'm new using this
I am using a Prism UnityExtensions bootstrapper class to start my WPF application. How
Our installer generates a bootstrapper (setup.exe) and a MSI file - a pretty common
Currently We are installing prequisties softwares using the bootstrapper. So i want to install
I have a WPF Desktop application using Prism 4, in my bootstrapper i have
I'd like to compile a static version of the Qt toolkit on the Windows
My GenericHost hosted service is failing to start with the following message: 2010-05-07 09:13:47,406

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.