System.ArgumentNullException: Value cannot be null. Parameter name: assemblyName

872 views
Skip to first unread message

Valerio Di Gregorio

unread,
Apr 27, 2015, 4:00:38 AM4/27/15
to particula...@googlegroups.com
Product name: NServiceBus
Version: 4.7.5

Stacktrace:

System.ArgumentNullException: Value cannot be null.
Parameter name: assemblyName
   at System.Reflection.AssemblyName..ctor(String assemblyName)
   at NServiceBus.Hosting.Helpers.AssemblyScanner.FormatReflectionTypeLoadException(String fileName, ReflectionTypeLoadException e) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 228
   at NServiceBus.Hosting.Helpers.AssemblyScanner.ScanAssembly(String assemblyPath, AssemblyScannerResults results) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 167
   at NServiceBus.Hosting.Helpers.AssemblyScanner.GetScannableAssemblies() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 80
   at NServiceBus.Configure.GetAssembliesInDirectory(String path, String[] assembliesToSkip) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 423
   at NServiceBus.Configure.With(String probeDirectory) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 219
   at NServiceBus.Configure.With() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 201
[...]
08:37:28,927 INFO  EurexEOBIPlayback_Playback1 ->  System.ArgumentNullException: Value cannot be null.
Parameter name: assemblyName
   at System.Reflection.AssemblyName..ctor(String assemblyName)
   at NServiceBus.Hosting.Helpers.AssemblyScanner.FormatReflectionTypeLoadException(String fileName, ReflectionTypeLoadException e) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 228
   at NServiceBus.Hosting.Helpers.AssemblyScanner.ScanAssembly(String assemblyPath, AssemblyScannerResults results) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 167
   at NServiceBus.Hosting.Helpers.AssemblyScanner.GetScannableAssemblies() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 80
   at NServiceBus.Configure.GetAssembliesInDirectory(String path, String[] assembliesToSkip) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 423
   at NServiceBus.Configure.With(String probeDirectory) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 219
   at NServiceBus.Configure.With() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 201
[...]

Description:

            Feature.Enable<Sagas>();
            Configure.Serialization.Xml();
            Bus = Configure.With()
                    .DefaultBuilder()
                    .UseTransport<Msmq>()
                    .UnicastBus()
                    .InMemorySagaPersister()
                    .CreateBus();

Hi all,
I'm quite new with the framework, do you know what's wrong with this error? I can't get rid of it. :(

Thanks for the help!

Mauro Servienti

unread,
Apr 27, 2015, 5:59:16 AM4/27/15
to particula...@googlegroups.com
Are you using any tool, such as an Embedded RavenDB version, that dynamically generates assemblies in the bin directory?

.m

--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at http://groups.google.com/group/particularsoftware.
To view this discussion on the web visit https://groups.google.com/d/msgid/particularsoftware/e9f4d354-99ed-4647-b954-2c72e0597544%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Valerio Di Gregorio

unread,
Apr 27, 2015, 8:04:15 AM4/27/15
to particula...@googlegroups.com
Hi Mauro, no I'm not using any tool like that. Actually mine is a simple proof-of-concept that I embedded in our infrastructure, so at the moment I'm using the InMemoryPersistence.

simon.cropp

unread,
Apr 27, 2015, 8:19:57 AM4/27/15
to particula...@googlegroups.com
Anything interesting in your log file?

If not can you upload a repro somewhere?

Valerio Di Gregorio

unread,
Apr 27, 2015, 10:27:34 AM4/27/15
to particula...@googlegroups.com
I can't get an SSCCE, I'll try to see if I can redirect the NServiceBus log output to our infrastructure logging system, because as of now I don't have access to the NServiceBus output.

Valerio Di Gregorio

unread,
Apr 27, 2015, 11:45:08 AM4/27/15
to particula...@googlegroups.com
If this code:

            Feature.Enable<Sagas>();
            Configure.Serialization.Xml();
            Bus = Configure.With()
                    .DefaultBuilder()
                    .UseTransport<Msmq>()
                    .UnicastBus()
                    .InMemorySagaPersister()
                    .CreateBus();

Prints all the logs into AppDomain.CurrentDomain.BaseDirectory as described by http://docs.particular.net/nservicebus/logging/, then I have no nsb_log_*.txt.

simon.cropp

unread,
Apr 27, 2015, 6:51:54 PM4/27/15
to particula...@googlegroups.com
That page http://docs.particular.net/nservicebus/logging/ is version 5 specific. 


V4 has no default log file when self hosting. you need to enable it. This samples http://docs.particular.net/samples/logging/log4net-custom/ has version 4 examples

Valerio Di Gregorio

unread,
Apr 28, 2015, 2:53:49 AM4/28/15
to particula...@googlegroups.com
Thanks for the links. This is all I have into the log file:

07:52:01,853 ERROR System.InvalidOperationException: There is an error in XML document (92, 4). ---> System.ArgumentNullException: Value cannot be null.
Parameter name: assemblyName
   at System.Reflection.AssemblyName..ctor(String assemblyName)
   at NServiceBus.Hosting.Helpers.AssemblyScanner.FormatReflectionTypeLoadException(String fileName, ReflectionTypeLoadException e) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 228
   at NServiceBus.Hosting.Helpers.AssemblyScanner.ScanAssembly(String assemblyPath, AssemblyScannerResults results) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 167
   at NServiceBus.Hosting.Helpers.AssemblyScanner.GetScannableAssemblies() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 80
   at NServiceBus.Configure.GetAssembliesInDirectory(String path, String[] assembliesToSkip) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 423
   at NServiceBus.Configure.With(String probeDirectory) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 219
   at NServiceBus.Configure.With() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 201
   at [...].NsbEndpoint..ctor() in c:\Users\[...]\NsbEndpoint.cs:line 28

Valerio Di Gregorio

unread,
Apr 28, 2015, 2:57:15 AM4/28/15
to particula...@googlegroups.com
And here is the code of my NsbEndpoint:

namespace [...]
{
    public class NsbEndpoint
    {
        public IStartableBus Bus { get; private set; }

        public NsbEndpoint()
        {
            SetLoggingLibrary.Log4Net(XmlConfigurator.Configure);
            Feature.Enable<Sagas>();
            Configure.Serialization.Xml();
            Bus = Configure.With()
                .DefaultBuilder()
                .UseTransport<Msmq>()
                .UnicastBus()
                .InMemorySagaPersister()
                .Log4Net()
                .CreateBus();
        }

        [...]
    }
}

Mauro Servienti

unread,
Apr 28, 2015, 3:53:16 AM4/28/15
to particula...@googlegroups.com
Hi Valerio,

On Tue, Apr 28, 2015 at 8:53 AM, Valerio Di Gregorio <valeriodigr...@gmail.com> wrote:
Thanks for the links. This is all I have into the log file:

07:52:01,853 ERROR System.InvalidOperationException: There is an error in XML document (92, 4). ---> System.ArgumentNullException: Value cannot be null.

What XML document is the exception referring to?
Can you show the config file? What is the content at line 92?

.m

Valerio Di Gregorio

unread,
Apr 28, 2015, 5:01:45 AM4/28/15
to particula...@googlegroups.com
Mauro, that's the point. I don't know what XML is that, it's not specified by the exception. The App.config file at line 92 has pre-existing log4net stuff in it which is not NServiceBus related:

91:   <layout type="log4net.Layout.PatternLayout">
92:      <conversionPattern value="%P{log4net:HostName}"/>
93:   </layout>

Moreover the null value is "assemblyName" which comes from an assembly scan. So I'm wondering why System.Reflection.AssemblyName..ctor() is called without a check on assemblyName null/empty values. I'll try to get more info about the error compiling the framework and debugging into it.

Valerio Di Gregorio

unread,
Apr 29, 2015, 6:48:59 AM4/29/15
to particula...@googlegroups.com
So the issue is that one dependency uses Google ProtoBuffers version X and a different dependecy uses version Y. So the second one overwrites version X with Y and NServiceBus fails loading them because of the version mismatch. Fusion logs helped me to understand that. Now I either have to fix this everywhere or find a way to tell NServiceBus to not dig into the mess and just do the job it is supposed to do. Any idea?

Andreas Öhlund

unread,
Apr 29, 2015, 7:02:52 AM4/29/15
to particula...@googlegroups.com
If those assemblies doesn't contain any message/messagehandlers you could just exclude them from the scanning


would that work?

On Wed, Apr 29, 2015 at 12:48 PM, Valerio Di Gregorio <valeriodigr...@gmail.com> wrote:
So the issue is that one dependency uses Google ProtoBuffers version X and a different dependecy uses version Y. So the second one overwrites version X with Y and NServiceBus fails loading them because of the version mismatch. Fusion logs helped me to understand that. Now I either have to fix this everywhere or find a way to tell NServiceBus to not dig into the mess and just do the job it is supposed to do. Any idea?

--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at http://groups.google.com/group/particularsoftware.

simon.cropp

unread,
Apr 29, 2015, 6:13:38 PM4/29/15
to particula...@googlegroups.com
As Andreas pointed out you should be able to exclude those assemblies to avoid the error. And good work using the Fusion log to diagnose the issue. As for "why NServiceBus not giving helpful logging" is seems we have a bug in our logging code. I have raised an issue to track it here https://github.com/Particular/NServiceBus/issues/2722

Valerio Di Gregorio

unread,
Apr 30, 2015, 3:41:56 AM4/30/15
to particula...@googlegroups.com
Thanks for the ticket Simon. I was able to get rid of the issue I had, but this brought me to the next exception. I'll investigate on that and perhaps I'll ask help if I get blocked again for too long time.

Valerio Di Gregorio

unread,
Apr 30, 2015, 3:43:32 AM4/30/15
to particula...@googlegroups.com
Yes that solved the issue. Thanks Andreas!

Valerio Di Gregorio

unread,
Apr 30, 2015, 3:51:05 AM4/30/15
to particula...@googlegroups.com
Simon, just a suggestion with the fix. I would also change:

07:52:01,853 ERROR System.InvalidOperationException: There is an error in XML document (92, 4). ---> System.ArgumentNullException: Value cannot be null.

With a more descriptive message as there are no XML documents involved into this. Maybe if you print out the assemblyPath variable (or whatever is named) the user can read which DLL caused the issue.
Reply all
Reply to author
Forward
0 new messages