Hello,
Recently we migrated our application from the .NET 3.5 to the .NET 4 framework. At first everything seemed to work fine, but yesterday we encountered an unexpected exception when trying to print a report.
The exception occurs when the application is run directly from the disk (from the bin folder) and *not* when running the application from Visual Studio 2010 (when the debugger/*.vshost.exe is attached/wrapped to/around it). After some research we decided to create a small demo application to demonstrate the problem. The demo application is added at the end of this message. We noticed the exception only occurs in the executable build with Solution Platform x64 in combination with the .NET 4 Framework, in Framework version 3.5 printing works fine in x64 built applications. The binaries of the different Solution Configuration/Platform combinations are also included in the attached sourcecode. Here is more additional information about the development environment:
Product:
Reports.Net 2010.2.800.0 (trial version)
Environment:
Windows Server 2008 R2 Standard (x64), dutch ( accessed from Windows XP Professional SP3 (x32) clients through remote desktop (mstsc.exe) )
.NET Framework (default localization): version 4
Until this problem is resolved we are unable to do any major releases of our application. Help is much appreciated.
Kevin Farrelly
Sample application (.cs):
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Stimulsoft.Report;
namespace ReportGdiExceptionExample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Print
ExampleReport report = ExampleReport.Create(ExampleReportData.GenerateRandomData());
report.Print();
}
private void button2_Click(object sender, EventArgs e)
{
// Design
ExampleReport report = ExampleReport.Create(ExampleReportData.GenerateRandomData());
report.Design();
}
private void button3_Click(object sender, EventArgs e)
{
// Close
Close();
}
private void button4_Click(object sender, EventArgs e)
{
// Print preview
ExampleReport report = ExampleReport.Create(ExampleReportData.GenerateRandomData());
report.Show();
}
}
public abstract class AbstractReport
{
private readonly StiReport _report;
public StiReport Report
{
get { return _report; }
}
protected AbstractReport(string reportPath)
{
_report = new StiReport
{
AutoLocalizeReportOnRun = true,
};
_report.Load(reportPath);
}
public virtual void Print()
{
Report.Print();
}
public virtual void Show()
{
if (!Report.IsCompiled)
{
Report.Compile();
}
_report.Show();
}
public void Design()
{
Report.Design();
}
}
public class ExampleReport : AbstractReport
{
private const string ReportPath = @"ExampleReport.mrt";
protected ExampleReport(string reportPath)
: base(reportPath)
{
}
public static ExampleReport Create(ExampleReportData data)
{
var report = new ExampleReport(ReportPath);
report.Report.RegData("Data", data);
return report;
}
}
public class ExampleReportData
{
private static readonly Random Random = new Random();
public string Title { get; set; }
public IEnumerable Lines { get; set; }
public static ExampleReportData GenerateRandomData()
{
const int lineCount = 50;
const int min = -100;
const int max = 100;
IList lines = new List();
for (int i = 0; i
Data
Title,System.String
Lines,System.Collections.Generic.IEnumerable`1[ReportGdiExceptionExample.ExampleReportLine]
_ID,System.Int32
_Current,System.Object
Data
Data
Data_Lines
ValueA,System.Int32
ValueB,System.Int32
ValueC,System.Int32
ValueD,System.Int32
_ID,System.Int32
_parentID,System.Int32
_Current,System.Object
Data_Lines
Data_Lines
Data
_parentID
Data
Data_LinesRelation
_ID
EngineV2
None;Black;2;Solid;False;4;Black
Transparent
Top;Black;1;Dot;False;4;Black
Transparent
0,26.9,19,0.8
Transparent
0.2,0.1,18.6,0.4
Arial,8,Italic
0,0,0,0
Text11
Printed: {Format("{0:dd-MM-yyyy}", Today)} @ {Format("{0:HH:mm:ss}", Time)}
Black
Expression
PageFooterBand1
Transparent
0,0.4,19,1
Transparent
0,0,19,1
Arial,24
Center
0,0,0,0
Text10
{Data.Title}
Black
ReportTitleBand1
Top;Black;1;Solid;False;4;Black
Transparent
0,2.2,19,0.4
Transparent
0,0,1.2,0.4
Arial,8
0,0,0,0
Text2
ValueA
Black
Transparent
1.8,0,1.2,0.4
Arial,8
0,0,0,0
Text4
ValueB
Black
Transparent
3.6,0,1.2,0.4
Arial,8
0,0,0,0
Text6
ValueC
Black
Transparent
5.4,0,1.2,0.4
Arial,8
0,0,0,0
Text8
ValueD
Black
GroupHeaderBand1
Transparent
0,3.4,19,0.4
Transparent
0,0,1.6,0.4
Arial,8
0,0,0,0
Text1
{Data_Lines.ValueA}
Black
Transparent
1.8,0,1.6,0.4
Arial,8
0,0,0,0
Text3
{Data_Lines.ValueB}
Black
Transparent
3.6,0,1.6,0.4
Arial,8
0,0,0,0
Text5
{Data_Lines.ValueC}
Black
Transparent
5.4,0,1.6,0.4
Arial,8
0,0,0,0
Text7
{Data_Lines.ValueD}
Black
Data_Lines
DataBand1
Top;Black;1;Solid;False;4;Black
Transparent
0,4.6,19,0.4
Transparent
5.4,0,1.6,0.4
Arial,8
78e75760d7a249a9b3b7ae776b61f9e3
0,0,0,0
Text9
{Sum(Data_Lines.ValueD)}
Black
Expression
GroupFooterBand1
5faea0579bf0429e932c1cc2755a74af
1,1,1,1
Page1
29.7
21
Arial,100
[50:0:0:0]
System.Dll
System.Drawing.Dll
System.Windows.Forms.Dll
System.Data.Dll
System.Xml.Dll
Stimulsoft.Controls.Dll
Stimulsoft.Base.Dll
Stimulsoft.Report.Dll
Report
10/6/2010 11:32:53 AM
10/6/2010 10:31:54 AM
ExampleReport.mrt
9e354c9acc5942479bf22118463a6f79
Report
Centimeters
2009.2.500
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;
namespace Reports
{
public class Report : Stimulsoft.Report.StiReport
{
public Report()
{
this.InitializeComponent();
}
#region StiReport Designer generated code - do not modify#endregion StiReport Designer generated code - do not modify
}
}
CSharp
[Reports.Net 2010.2.800.0] .NET 4 Framework, x64 => A generic error occurred in GDI+
-
- Posts: 1
- Joined: Thu Oct 07, 2010 8:54 am
[Reports.Net 2010.2.800.0] .NET 4 Framework, x64 => A generic error occurred in GDI+
Hello,
We will answer you from tickets system.
Thank you.
We will answer you from tickets system.
Thank you.