Re: XLANGPart.LoadFrom(stream) failing - UnauthorizedAccessException
- From: "Scott Colestock" <scolestock@xxxxxxxxxxxxxxxx>
- Date: Tue, 8 Aug 2006 09:38:18 -0500
A MemoryStream will always return this exception (when GetBuffer is called)
when it is constructed with an existing byte array (which must be what is
happening with your call to Crystal's ExportToStream.)
What I would do is try creating an intermediate MemoryStream that you
allocate and write to yourself (a copy of the content in the original
stream.)
Scott Colestock
www.traceofthought.net
"Sergiy" <bryn@xxxxxxxxxxxxxxxxxx> wrote in message
news:OSXQQEpuGHA.324@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I am trying to update an XLANGMessage in my custom component. I have an
orchestration that receives message A.
In a construct shape (declared as constructing message B), message A is
then assigned to message B, and message B is passed from a message
assignment shape into my component as a parameter to a method.
My component then generates a PDF stream using Crystal Reports, and then
attempts to load the XLANGMessage's 1st data part with the stream
generated by Crystal. This is causing an error (details at bottom of
post).
The error indicates that the GetBuffer method is causing the error. I have
tried wrapping the memory stream in a BufferedStream, but this causes
another exception altogether indicating the Load method is expecting a
MemoryStream to load from.
Does anyone have any ideas what I am doing wrong? Is there any other way
to load the stream into the part's data?
Details of code are:
// Create a crystal report object
ReportDocument report = new ReportDocument();
/// Load report here and bind to data...
// Export report to stream. Actual stream generated by Crystal is a
MemoryStream
Stream reportStream =
report.ExportToStream(ExportFormatType.PortableDocFormat);
// Stream now has data.
// Load data into XLANGMessage part. THIS CAUSES EXCEPTION...
dataMessage[0].LoadFrom(reportStream);
ERROR DETAILS:
====================
Exception thrown from: segment 1, progress 8
Inner exception: MemoryStream's internal buffer cannot be accessed.
Exception type: UnauthorizedAccessException
Source: mscorlib
Target Site: Byte[] GetBuffer()
The following is a stack trace that identifies the location where the
exception occured
at System.IO.MemoryStream.GetBuffer()
at Microsoft.XLANGs.Core.Value..ctor(Stream s)
at Microsoft.XLANGs.Core.Part.GenericLoadFrom(Object source)
at Microsoft.XLANGs.Core.XSDPart.ProtectedLoadFrom(Object source)
at Microsoft.XLANGs.Core.Part.LoadFrom(Object source)
at Microsoft.XLANGs.Core.PartWrapperForUserCode.LoadFrom(Object source)
at
Bryn.BabelTower.BizTalk.Core.Components.ReportGenerator.GenerateReport(XLANGMessage
dataMessage, String reportPath)
at
Bryn.BabelTower.BizTalk.Core.Orchestrations.ReportGenerator.segment1(StopConditions
stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp)
.
- References:
- Prev by Date: Need help with Flat File assembler
- Next by Date: Re: Problem with Biztalk Explorer
- Previous by thread: XLANGPart.LoadFrom(stream) failing - UnauthorizedAccessException
- Next by thread: Allow cache on write
- Index(es):
Relevant Pages
|