PDF Export issue in Reporting Services - pdf

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.

Related

Protobuf-net - The stream does not support concurrent IO read or write operations

I have a program in VB.Net (v2.0 framework) and while doing http post from a sql data reader, I am getting the following error on few machines:
System.NotSupportedException: The stream does not support concurrent IO read or write operations.
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at ProtoBuf.ProtoWriter.Flush(ProtoWriter writer)
at ProtoBuf.ProtoWriter.Dispose()
at ProtoBuf.ProtoWriter.System.IDisposable.Dispose()
at ProtoBuf.Meta.TypeModel.SerializeWithLengthPrefix(Stream dest, Object value, Type type, PrefixStyle style, Int32 fieldNumber, SerializationContext context)
at ProtoBuf.Serializer.SerializeWithLengthPrefix[T](Stream destination, T instance, PrefixStyle style, Int32 fieldNumber)
at ProtoBuf.Serializer.SerializeWithLengthPrefix[T](Stream destination, T instance, PrefixStyle style)
Code:
postStream = request.GetRequestStream()
While dr.Read()
dd.Add(dr) ' Adding data row to proto
ProtoBuf.Serializer.SerializeWithLengthPrefix(Of DataDump)(postStream, dd, ProtoBuf.PrefixStyle.Base128) ' stream proto to http post stream
dd.Clear() ' Clear proto
End While
response = DirectCast(request.GetResponse(), HttpWebResponse)
Protobuf-net does not issue concurrent read or write operations. Since you mention request streams, I expect the actual problem is related to this question.
In the end, it is not a protbuf-net related issue at all. Even after saving the protos in binary file and then trying to upload, it throws the error.
It might be httpwebrequest, .net or windows patch or sophos antivirus.
I am closing this question as it has gone in different tangent.
Thanks for all your help.

SSIS to SSRS communication issue

I have an SSIS package that retrieves a days worth of information from a data warehouse into a table in SQL Server and then exports that data to a flat file.
The package then generates a PDF report from the same data that was exported.
In order to export the PDF file, the report had to be created in SSRS and published to a URL the SSIS package could get to.
The package contains three connection managers, one to SQL Server, one to the Flat File and one to SSRS via an HTTP Connection Manager.
The HTTP Connection Manager allows me to create a connection to my SSRS instance and there is a button on that dialog that allows you to test the connection.
The connection tests correctly and I receive a success message.
I have done this exact thing in numerous other environments and it works correctly.
Some things to be aware of are, I created this package on another machine and copied it to numerous environments. Because of this, I use a configuration file to store many of the settings the package uses, file paths, login credentials and other things.
I also made sure that the connection settings were correct and that I could browse to the Report Server and view the report I am trying to download in SSIS.
When I execute the package, I receive the following error message from the package:
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException: Exception from HRESULT: 0xC001600E ---> System.Runtime.InteropServices.COMException (0xC001600E): Exception from HRESULT: 0xC001600E
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSHttpClientConnection100.DownloadFile(String FileName, Boolean vbOverwriteDestination)
at Microsoft.SqlServer.Dts.Runtime.HttpClientConnection.DownloadFile(String fileName, Boolean OverwriteDestination)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Dts.Runtime.HttpClientConnection.DownloadFile(String fileName, Boolean OverwriteDestination)
at ST_6b197a6290df4aff91a6881078049a14.csproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
That's about all I can think of that would be useful, but if you have any questions, I'll be monitoring this thread for a couple of hours.
Thanks.

WCF pipe connection aborted with error:There was an error reading from the pipe: Unrecognized error 109

I am designing a WCF service with callback using named pipe binding. And when I call the service from the client, on the server side tracing it shows the error "There was an error reading from the pipe: Unrecognized error 109" and eventually the pipe connection got aborted. But I have absolutely no clue what caused the problem. The tracing doesn't give more information except the stack trace:
System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
and another 109 error with stack trace
System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
I suspected it has something to do with the return value of the operation based on the tracing activities flow. But even if I declare return type of the operation as void, I still get this error. Another thing is although I am using callback, but it doesn't call the callback inside the operation.
Any help will be appreciated, or guide me on how to debug the pipe connection aborted, I bet there is some way to get more verbose information. For example how to catch the exception mentioned above(try catch block inside the server operation doesn't get anything, neither does the client side calling function).
Turned out I didn't call the client.Close() function in some stage. So when the client program exit, the channel got aborted and the server showed the mentioned error
Oversized messages can cause this error. Are you sending lots of data from the client?
I think I've also had it when I was sending an enum, but the value wasn't a valid enum value.
Also some very useful info here about tracking down the problem.

How do I determine which DateTime format WCF is using when it calls DateTime.ParseExact?

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.

NServiceBus: "ArgumentNullException" being thrown by NServiceBus

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.