in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

RenderToStream throws a "The object is currently in use elsewhere" exception

Last post 05-16-2008 10:57 AM by eppinkf. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 04-03-2008 8:53 AM

    RenderToStream throws a "The object is currently in use elsewhere" exception

    When calling C1.Win.C1Report.C1Report.RenderToStream(Stream stream, FileFormatEnum fmt, String idPrefix, String fileName) the following exception occurs: "System.InvalidOperationException: The object is currently in use elsewhere".

    System.InvalidOperationException: The object is currently in use elsewhere.   at System.Drawing.Graphics.Dispose(Boolean disposing)   at System.Drawing.Graphics.Dispose()   at C1.C1Pdf.ad.a()   at C1.C1Pdf.ad.a(al A_0)   at C1.C1Pdf.al.a(Stream A_0)   at C1.Win.C1Report.PdfFilter.EndReport()   at C1.Win.C1Report.Layout.h()   at C1.Win.C1Report.C1Report.k()   at C1.Win.C1Report.C1Report.a(ExportFilter A_0, Boolean A_1)   at C1.Win.C1Report.C1Report.RenderToStream(Stream stream, FileFormatEnum fmt, String idPrefix, String fileName)

       at C1.Win.C1Report.C1Report.RenderToStream(Stream stream, FileFormatEnum fmt)

     

    We have been using this method for a long time and we have not yet seen this problem. I found another (old) post related to this (

    http://helpcentral.componentone.com/CS/forums/p/70720/192794.aspx#192794) but there was no reply on this topic.

    We are using .Net Framework version 1.1Version of 2.5.20062.212 of file "C1.Win.C1Report.dll"Regards, Frank
  • 04-08-2008 5:48 AM In reply to

    Re: RenderToStream throws a "The object is currently in useelsewhere" exception

    Hi,

    just one guess: do you use threads to either render your reports or write them
    to a file? If yes: try to remove them (accessing a GUI object from different
    threads might cause strange problems in .NET 1.1 and will throw "cross thread
    operation" exceptions in .NET 2.0).

    Hope this helps

    Wolfgang
  • 04-16-2008 3:28 AM In reply to

    Re: RenderToStream throws a "The object is currently in useelsewhere" exception

    We are using a locking mechanism to prevent multiple threads to enter the method which calls RenderToStream. So this should not be the cause of the problem. Unfortunately (and maybe not surprisingly) the problem is not reproducible.

    Thanks for the hint

    Frank

  • 05-01-2008 1:28 AM In reply to

    Re: RenderToStream throws a "The object is currently in useelsewhere" exception

    Hi
     
    If you do face the problem again then open the Reprot definition file in C1Report Designer for .NET, save it and close. Then use the newly saved report definition file in your ..NET application.
     
    Regards
    Dave
    <eppinkf> wrote in message news:203928@10.0.1.98...

    We are using a locking mechanism to prevent multiple threads to enter the method which calls RenderToStream. So this should not be the cause of the problem. Unfortunately (and maybe not surprisingly) the problem is not reproducible.

    Thanks for the hint

    Frank



    http://helpcentral.componentone.com/cs/forums/p/74829/203928.aspx#203928

  • 05-14-2008 8:32 AM In reply to

    Re: RenderToStream throws a "The object is currently in use elsewhere" exception

    Regarding the hint with the different threads: I wrote a UnitTest which calls the method from two different threads and both work fine. So at least the different threads are not a general problem.

    Regarding the hint with opening and saving the Report Definition file in the C1Report Designer: Is there a known reason why this should work?

    The problem is, that I cannot reproduce this problem and that the client is quite far away and I do not have the possibility to access the machine where the problem occurs. Therefore trial and error is difficult.

    Any more hints are welcome.

  • 05-16-2008 10:49 AM In reply to

    Re: RenderToStream throws a &quot;The object is currently in useelsewhere&quot; exception

    Hi,

    in .NET 1.1 (and somehow in .NET 2.0 either) the problem with "cross thread
    operations" is that in some cases they do not occur reproducible. On my fast
    dual core machine, they come up more often than on customer systems ;-).
    But of course it is quite possible that your errors do not result from this.

    Do you have the chance to take a look on the remote machine with e.g. TeamViewer?

    Best regards

    Wolfgang
  • 05-16-2008 10:57 AM In reply to

    Re: RenderToStream throws a &quot;The object is currently in useelsewhere&quot; exception

    Hi Wolfgang

    What do you mean with "Remote Machine"? The error was seen once on one of our test PCs and once at the clients site. It is very hard if not impossible to access the PC at the clients site. We have full access to our test PC, but the problem is that without reproducibility what shall we check on this PC?

    Best Regards

    Frank

Page 1 of 1 (7 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.