C1PrintDocument and C1DocumentViewer crashing

Posted by: przemyslaw.dekiel on 16 June 2020, 3:34 am EST

    • Post Options:
    • Link

    Posted 16 June 2020, 3:34 am EST

    Hi,

    when I’m trying to create new instances of both those classes,

    var viewer = new C1DocumentViewer();

    and

    var printDocument = new C1PrintDocument();

    my software crashes with following error:

    System.TypeLoadException

    HResult=0x80131522

    Message=Could not load type ‘System.AppDomainManager’ from assembly ‘mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

    Source=C1.WPF.C1Report.4

    StackTrace:

    at C1.Util.Licensing.ProviderInfo.IsMsIdeDomainManager()

    at C1.Util.Licensing.ProviderInfo.IsDesignTime(LicenseContext context)

    System.MissingMethodException

    HResult=0x80131513

    Message=Method not found: ‘System.String System.AppDomainSetup.get_LicenseFile()’.

    Source=C1.WPF.C1Report.4

    StackTrace:

    at #AT.#eU.#6T(LicenseContext #8H, Type #db, Assembly #5T)

    at #AT.#eU.#4T(LicenseContext #8H, Type #db, Assembly #5T)

    The error seems to be suggesting a license issue, but I can’t figure out what might be wrong with it. Here are the contents of my .licx file:

    C1.WPF.FlexGrid.C1FlexGrid, C1.WPF.FlexGrid.4

    C1.WPF.C1Report.C1DocumentViewer, C1.WPF.C1Report.4

    C1.C1Preview.C1PrintDocument, C1.WPF.C1Report.4

    Is it missing something? (It’s worth mentioning, that flex grid controls aren’t causing any problems).

    Thanks,

    Przemyslaw

  • Posted 17 June 2020, 4:29 am EST

    Hello,

    Thank you for sharing the exception message and stack trace. Are you using the WPF controls in a .Net Core type project? If not, would it be possible for you to share a small application showing the issue?

    I tried creating a simple WPF application and do not face any exception when creating instances of the said classes.

    Thanks,

    Ruchir

  • Posted 17 June 2020, 8:14 pm EST

    Hi Ruchir,

    thanks for your reply.

    Yes, it’s a .Net Core project.

    Thanks,

    Przemyslaw

  • Posted 18 June 2020, 6:00 pm EST

    Hello,

    Thank you for confirming the project type.

    Which ComponentOne version are you using? The support for .Net Core might not be available in older version of the components. So, I would suggest you to use the latest version 4.5.20201.416, as I can verify that using this version of the component

    there are no errors thrown with .NetCore 3.1 WPF project. Refer attached application.

    Thanks,

    Ruchir

    LicensesValidation_WPF.zip

  • Posted 16 July 2020, 1:14 am EST

    Hello Ruchir,

    thanks for your help so far.

    creating the instances of C1PrintDocument and C1DocumentViewer is no longer crashing (looks like the crash was caused by something else - sorry about that!), but they still cause a lot of exceptions before finally succeeding, which in turn causes a really long delay.

    a second problem is displaying a report preview - it’s working fine if I add some items too it, for example RenderText, but opening a preview with a RenderImage inside is crashing the application as soon as the mouse is over the image on the preview (System.IO.IOException: ‘Entries cannot be opened multiple times in Update mode.’).

    Those issues are occurring with the C1.WPF.C1Report.4.dll I was originally using (version 4.0.20163.226), the one you recommended (4.0.20201.416 - I assume this is the one you meant, I didn’t have version 4.5.20201.416 available), and the latest one (4.0.20202.438).

    Is there any solution for those problems?

    I modified your application to show you all those problems.

    Thanks,

    Przemyslaw

  • Posted 16 July 2020, 1:35 am EST

    Hi Ruchir,

    looks like I actually forgot to attach the project in the previous post! Sorry about that, here it is.

    Thanks,

    Przemyslaw

    LicensesValidation_WPF.zip

  • Posted 16 July 2020, 9:17 pm EST

    Hello,

    Running the application you shared, I could see the issue occurring at my end as well. Hence, I have forwarded it to the concerned team for fix [ID: 448504].

    I will update you as soon as there is some conclusion.

    Regards,

    Ruchir

  • Posted 23 July 2020, 3:21 pm EST

    Hello,

    The team was also able to replicate the problem. However, it is not ComponentOne related issue, instead it’s a Microsoft issue in .NET Core that MS’s DocumentViewer can’t show xps files.

    We are attaching following few posts reported by MS customers for the same issue in .NET Core platform:

    https://github.com/dotnet/runtime/issues/39430

    https://github.com/dotnet/runtime/issues/24962

    https://github.com/dotnet/runtime/issues/27397

    So, I would suggest you to contact Microsoft for the issue.

    Thanks,

  • Posted 13 August 2020, 12:16 am EST

    Hello Ruchir,

    thanks for those links, but is there any potential workaround to create a document preview with images using C1 tools?

    And my second question: is there any way to improve the performance of creating C1PrintDocument and C1DocumentViewer instances? It is really slow, as presented in my demo app.

    In the meantime, I have found another problem - trying to use Document.Tags to include headers and footers in the document throws a System.PlatformNotSupportedException: ‘Operation is not supported on this platform.’

    This part of the code in our app is pretty old, and I wouldn’t be surprised if it’s not used entirely correctly, so I would appreciate some advice on how to implement headers and footers correctly. I have once again modified the demo app to show you the problem.

    Thanks,

    Przemyslaw

    LicensesValidation_WPF_2020.08.13.zip

  • Posted 14 August 2020, 6:25 am EST

    Hi Przemyslaw,

    1. I am investigating and discussing it with team. Will keep you updated on this.
    2. Can you share the time taken at your end, in creating the C1PrintDocument and C1DocumentViewer instances?
    3. Please try to use the approach as suggested here: https://www.grapecity.com/blogs/tips-tricks-in-c1printdocument [Step 1]

    Thanks,

  • Posted 27 September 2020, 10:44 pm EST

    Hi Ruchir,

    1. are there any updates on the workaround document preview with images?

    2. at the moment I’m again experiencing some licensing issues, so I’m unable to create those instances in my demo app - I will update you with those as soon as I have time to resolve the licensing issues.

    3. Thanks for that link, it was helpful, but how to implement page numbering using this approach?

    Thanks,

    Przemyslaw

  • Posted 28 September 2020, 5:44 pm EST

    Hi,

    1. I have asked for an update on this. Will get back to you as soon as receive some information.

    2. Sure. If needed, please refer the following page that discusses the common license related problems: https://www.grapecity.com/componentone/docs/license/online-license/common-licensing-scenarios.html

    3. You can use built-in tags that act as placeholders within string expressions. These tags are at run time when headers and footers are rendered. The tags are [PageNo] for the current page number, and [PageCount] for the total number of pages in the document.```

      PageLayout pagelayout = new PageLayout();

      RenderText pagefooter = new RenderText();

      pagefooter.Text = " Page [PageNo] of [PageCount]";

      pagelayout.PageFooter = pagefooter;

      C1PrintDocument1.PageLayout.PageFooter = pagelayout.PageFooter;

  • Posted 1 October 2020, 11:02 pm EST

    Hello,

    1. Regarding the workaround document preview with images: The developers have shared information that the issue is not yet fixed from MS’s side. Our developers are trying to use another control to view the image but have not been successful yet. So, would it be possible for you to use another way to load image preview. Like creating C1Bitmap from the image?

    Thanks,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels