Kirsten
Kirsten

Reputation: 18160

Deserialization from CodeDOM format is not supported in .NET Core applications. [XAF Winforms]

I recently upgraded my .Net Framework XAF Winforms application.Net8 with 24.1.3

As follows

   public static void DoPrintReport(DevExpress.ExpressApp.View view, IReportDataV2 reportData, ReportsModuleV2 reportsModule)
   {
       //var report = ReportDataProvider.ReportsStorage.LoadReport(reportData);
       // IReportStorage reportStorage = ReportDataProvider.GetReportStorage(Application.ServiceProvider);
       // https://supportcenter.devexpress.com/ticket/details/bc4930/web-reporting-deserialization-from-the-codedom-format-has-been-disabled

       // changed to
       IReportStorage reportStorage = ReportDataProvider.GetReportStorage(null);
       var report = reportStorage.LoadReport(reportData); // gives error 

When this runs I get

Deserialization from CodeDOM format is not supported in .NET Core applications.

   at DevExpress.XtraReports.UI.XtraReport.LoadLayoutInternal(Stream stream, XtraReport& compiled report, Boolean forceDataSource, AccessSettings accessSettings, Boolean ignoreFileExtensionValidation, Func`1 trustPrompt)
   at DevExpress.XtraReports.UI.XtraReport.LoadLayoutInternal(Stream stream, Boolean ignoreFileExtensionValidation, Func`1 trustPrompt)
   at DevExpress.XtraReports.UI.XtraReport.LoadLayout(Stream stream)
   at DevExpress.ExpressApp.ReportsV2.ReportStorageBase.LoadReportCore(IReportDataV2 reportData, XtraReport report)
   at DevExpress.ExpressApp.ReportsV2.ReportStorageBase.LoadReport(IReportDataV2 reportData)
   at SBD24.JT.Win.Functions.WinHandyReportFunctions.DoPrintReport(View view, IReportDataV2 reportData, ReportsModuleV2 reportsModule) in C:\Users\kirst\source\repos\SBD24.JT\SBD24.JT.Win\Functions\WinHandyReportFunctions.cs:line 20

The report is stored in the ReportDataV2 table

From this help I understand I need to convert the content field of the report record to XML format.

I am wondering how. Or whether there is some kind of flag to make it work since I am running in Winforms.

Update

Researching writing a framework application to do the conversions. That is proving hard since the latest xaf wizards dont support Entity Framework with .Net Framework

Update

I tried reinstalling XAF 20.2.3 but VS2022 is not a supported IDE

Upvotes: 0

Views: 388

Answers (1)

Daneda
Daneda

Reputation: 26

Try this, I'm using v.22.*

try
 {
     xtraOpenFileDialog1.Filter = "repx files (*.repx)|*.repx";

     var dr = xtraOpenFileDialog1.ShowDialog();

     if (dr == DialogResult.OK)
     {
         XtraReport report = new XtraReport();
         report.LoadLayout(xtraOpenFileDialog1.FileName);
         report.SaveLayoutToXml(xtraOpenFileDialog1.FileName);

         MessageBox.Show($"File '{xtraOpenFileDialog1.SafeFileName}' coverted to XML format");
     }
 }
 catch (Exception ex)
 {
     MessageBox.Show($"File '{xtraOpenFileDialog1.SafeFileName}' failed to covert to XML format");
 }

Upvotes: 1

Related Questions