I am trying to call Bus.Publish to publish a message, but I can't tell what's wrong, because the exception from NSB is just that there is a null argument.
Here is the stack trace:
System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at NServiceBus.Serializers.XML.MessageSerializer.WriteObject(String name, Type type, Object value, StringBuilder builder)
at NServiceBus.Serializers.XML.MessageSerializer.Serialize(IMessage[] messages, Stream stream)
at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage m, String destination)
at NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations, String correlationId, MessageIntentEnum messageIntent, IMessage[] messages)
at NServiceBus.Unicast.UnicastBus.Publish[T](T[] messages)
Can anyone help?
Found the answer. Apparently it is illegal in NServiceBus to use a message type which is not declared in a namespace. Don't ask me why, but the legacy code containing the type I wanted to publish didn't declare the type in a namespace so I had to make a new type to get it to work.
Related
As my first task working with vb.net, I was assigned the job of migrating a VB6 project over to vb.net using Visual Studio 2008. I am now working with Visual Studio 2017 and have gone through and cleared up all of the Upgrade Warnings that the conversion process gave me. The only remaining issues I have are with two instances of "Class Not Registered" Exceptions.
Things to note:
the original vb6 program was on a Windows XP machine. I am currently working on a Windows 7 64bit system.
I have read a couple of other posts here and here, but I haven't been able to solve my issue.
This warning is more specifically related to a Design view of a form
I believe the issue is probably something to do with a missing dll, as I had to move the source code to another computer to do the debugging.
Here is the call stack if anyone can help point me in the right direction:
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Instances of this error (2)
1. Hide Call Stack
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.set_Site(ISite value)
at System.ComponentModel.Container.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)
Thanks for the help!
In order to write an app handling the database responses I need to know the possible structures and values of the ubiquitous error parameter.
all the callbacks have:
function(err, res) ...
Does anyone know about the structure of the err object?
When provided to the callback, the err parameter contains an Error-based object. The name property of the object can be used to differentiate the types of errors, and the message property contains a string description of the error.
Looks like $err is usually a string type. See http://jp.wiki.mongodb.org/display/DOCS/Error+Handling+in+Mongo+Drivers
My WCF service fails to deserialize an XML response. I get an error stating that 'String was not recognized as a valid DateTime.'
I see in the stack trace that the code fails on
System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style) +6364410
System.Xml.Serialization.XmlCustomFormatter.ToDate(String value) +58
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderINgiReportingMgmnt.Read50_TransactionItem_Type(Boolean isNullable, Boolean checkType) +629
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderINgiReportingMgmnt.Read105_transactionDetailRs() +1261
Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer54.Deserialize(XmlSerializationReader reader) +43
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +579
How do I figure out which Datetime format WCF is using? And how do I change the format? I can't control what format I get the dates in.
PS: The date in the XML is "2010-01-03T11:59:59". This deserializes fine using a normal DateTime.Parse.
Turns out the exact format did not matter. The problem was that the wsdl (the xsd specifically) specified that the value is an xsd:date. But since the value had time as part of the string the deserializer threw an exception.
So the problem was with incorrect data. I asked that the XSD be changed.
I have a WCF service I use to submit bugs for my project. Snippet of the data class:
Private _exception As Exception
<DataMember()> _
Public Property Exception As Exception
Get
Return _exception
End Get
Set(ByVal value As Exception)
_exception = value
End Set
End Property
I have a Silverlight app that uses the WCF service to send any bugs home if and when they occur. This is the error I'm testing with:
Dim i As Integer = 5
i = i / 0
The problem is SL is banging on with this message:
System.ServiceModel.CommunicationException was unhandled by user code
Message=There was an error while trying to serialize parameter :bug. The InnerException message was 'Type 'System.OverflowException' with data contract name 'OverflowException:http://schemas.datacontract.org/2004/07/System' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
Is there some trick to get a generic .NET Exception (any InnerException) to serialize properly? I'm not doing anything funky with the exception - it's just a plain 'ol exception
Thanks for any help.
I doubt very much that you can serialize a .NET-specific type like an Exception. I recommend you create your own class to hold the parts of the exception you want serialized.
This may be a problem with implicitly casting the OverflowException into a System.Exception.
The data contract serializer is very specific. This can be good and bad.
I would try just throwing a new System.Exception to see if this works OK.
If this is the case, you may need to dumb down the exception, creating a new System.Exception with the original exception message in it.
Or, like John said, you might have a better go of it if you create a custom error class that holds the exception info.
I have come across an error when exporting a report to PDF in Reporting Services 2008.
The error message is;
Object reference not set to an
instance of an object. Description:
An unhandled exception occurred during
the execution of the current web
request. Please review the stack trace
for more information about the error
and where it originated in the code.
Exception Details: System.Exception:
Object reference not set to an
instance of an object.
Source Error:
An unhandled exception was generated
during the execution of the current
web request. Information regarding the
origin and location of the exception
can be identified using the exception
stack trace below.
Stack Trace:
[Exception: Object reference not set
to an instance of an object.]
[Exception: An error occurred during
rendering of the report.]
[Exception: An error occurred during
rendering of the report.]
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean
isAbortable, String url, Stream
outputStream, String& mimeType,
String& fileNameExtension) +520
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean
isAbortable, String format, String
deviceInfo, NameValueCollection
urlAccessParameters, Stream
reportStream, String& mimeType,
String& fileNameExtension) +963
Microsoft.Reporting.WebForms.ServerReport.Render(String
format, String deviceInfo,
NameValueCollection
urlAccessParameters, Stream
reportStream, String& mimeType,
String& fileNameExtension) +28
Microsoft.Reporting.WebForms.ServerModeSession.RenderReport(String
format, Boolean
allowInternalRenderers, String
deviceInfo, NameValueCollection
additionalParams, Boolean
cacheSecondaryStreamsForHtml, String&
mimeType, String& fileExtension) +85
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection
urlQuery, HttpResponse response) +150
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext
context) +183
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+181 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)
+75
However this error doesn't always appear on this report, it has only occurred on several occasions, dependent on the dates we use in the parameters of the report. I am new to Reporting Services so could anyone help me figure out what could be causing the problem?
Hide row logic cause this error. The hide row logic was referencing a value from a dataset not assign to the table. When I removed that hide logic it exported fine. To solve it I just wrote the hide logic differently to use only values from the tables dataset.
I've figured out what was causing this (in my case.) It was happening because one of the fields within the grid of my report contained commas and spaces. Each of these characters caused the dreaded 'object reference...' exception to be thrown. I used a REPLACE function in the stored proc that drives the report to replace commas and spaces with the pipe character. It is not a very graceful solution, so I'd be interested to hear if anyone else has ideas around this issue.