GetReportFromAssembly did not work

Stimulsoft Reports.NET discussion
dikan
Posts: 202
Joined: Thu Jun 18, 2009 5:05 pm
Location: Serbia

GetReportFromAssembly did not work

Post by dikan »

I just upgraded my StimulSoft license to Ultimate and after that I have very strange problem.

I have some simple code which I used all over my applications and it works with no problem

Report = StiReport.GetReportFromAssembly(fileName);

and now it does not work any more.
I recompiled my dll (assembly files) with new designer but nothing changed.

Any clue?
dikan
Posts: 202
Joined: Thu Jun 18, 2009 5:05 pm
Location: Serbia

GetReportFromAssembly did not work

Post by dikan »

I triad with .MRX files with code like this and it works without problems.

.Load(file)
.Compile
.Render

Maybe this helps.

Regards,
Djole
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

GetReportFromAssembly did not work

Post by Jan »

Hello,

Did you receive any error messages? Can you post full error stack? Usually its a problem of incompatible versions of the reporting tool that loads the assembly and the version of the reporting tool which create report assemblies.

Thank you.
dikan
Posts: 202
Joined: Thu Jun 18, 2009 5:05 pm
Location: Serbia

GetReportFromAssembly did not work

Post by dikan »

This is from UHE window

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Test.MainForm.Button1_Click(Object sender, EventArgs e) in e:\AC6\StimulSoft\Test\MainForm.cln:line 47
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4200 (NetFxQFE.050727-4200)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Test
Assembly Version: 1.0.3995.2459
Win32 Version: 1.0.3995.2459
CodeBase: file:///E:/AC6/StimulSoft/Test/bin/Debug/Test.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4205 (VistaSP2GDR.050727-4200)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
SoftVelocity.Clarion.Runtime.Procedures
Assembly Version: 2.0.213.7036
Win32 Version: 2.0.213.7036
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/SoftVelocity.Clarion.Runtime.Procedures/2.0.213.7036__4aca31c24e330653/SoftVelocity.Clarion.Runtime.Procedures.dll
----------------------------------------
SoftVelocity.Clarion.Runtime.Classes
Assembly Version: 2.0.213.7036
Win32 Version: 2.0.213.7036
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/SoftVelocity.Clarion.Runtime.Classes/2.0.213.7036__4aca31c24e330653/SoftVelocity.Clarion.Runtime.Classes.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Stimulsoft.Report
Assembly Version: 2010.3.900.0
Win32 Version: 2010.3.900.0
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Stimulsoft.Report/2010.3.900.0__ebe6666cba19647a/Stimulsoft.Report.dll
----------------------------------------
Stimulsoft.Base
Assembly Version: 2010.3.900.0
Win32 Version: 2010.3.900.0
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Stimulsoft.Base/2010.3.900.0__ebe6666cba19647a/Stimulsoft.Base.dll
----------------------------------------
Stimulsoft.Report.Design
Assembly Version: 2010.3.900.0
Win32 Version: 2010.3.900.0
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Stimulsoft.Report.Design/2010.3.900.0__ebe6666cba19647a/Stimulsoft.Report.Design.dll
----------------------------------------
Stimulsoft.Controls
Assembly Version: 2010.3.900.0
Win32 Version: 2010.3.900.0
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Stimulsoft.Controls/2010.3.900.0__ebe6666cba19647a/Stimulsoft.Controls.dll
----------------------------------------
Stimulsoft.Controls.Win
Assembly Version: 2010.3.900.0
Win32 Version: 2010.3.900.0
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Stimulsoft.Controls.Win/2010.3.900.0__ebe6666cba19647a/Stimulsoft.Controls.Win.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
Stimulsoft.Editor
Assembly Version: 2010.3.900.0
Win32 Version: 2010.3.900.0
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Stimulsoft.Editor/2010.3.900.0__ebe6666cba19647a/Stimulsoft.Editor.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:





When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


Attachments

[The extension dll has been deactivated and can no longer be displayed.]

dikan
Posts: 202
Joined: Thu Jun 18, 2009 5:05 pm
Location: Serbia

GetReportFromAssembly did not work

Post by dikan »

Do you need any additional information about this?

Regards,

Djole

Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

GetReportFromAssembly did not work

Post by Alex K. »

Hello,

Sorry, but I cannot say something by the full error stack, because the error occur before calling the designer. .dll files attached are not loaded, and we cannot reproduce the error.
Could you please send the report (the project) so that we can compile it and try to run.

Thank you.
dikan
Posts: 202
Joined: Thu Jun 18, 2009 5:05 pm
Location: Serbia

GetReportFromAssembly did not work

Post by dikan »

Problem is with every report in DLL format.
I have no problems with running reports from Designer or running them from .MRX format within application. Only DLL format.
It is slowing down my application and I don't know what to do. I tried to remove every trace of old installation so I believe that previously mentioned possible reason is not an option now.
BTW I already sent you one of those reports few days ago in my other thread which is about PageFooter. This report I also can not run as .DLL

Regards,

Djordje
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

GetReportFromAssembly did not work

Post by Martin Hart Turner »

I also use this method extensively, and I just might be able to throw some light on the subject.

When you change the version of StimulReports you need to regenerate any dll's created by the previous version.

In my programs I usually catch this exception and use the uncompiled report to regenerate (recreate) the dll, this way the user does not know that anything untoward has happened. Of course another way around this would be to eliminate all report dll's after updating StimulReports.

HTH,
Martin.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

GetReportFromAssembly did not work

Post by Jan »

Hello,

This is not restriction of Stimulsoft. This is feature of .Net Framework. You need use same versions of assemlies which referenced and which loaded. Also you can use following code to generate automatically new version of report assembly:

Code: Select all

private void RenderReport(ReportAction reportAction)
        {
            if (tvReports.SelectedNode != null && tvReports.SelectedNode.Parent != null)
            {
                string file = StiConfig.ApplicationDirectory + "\\" + "Reports\\" + tvReports.SelectedNode.Tag as string;

                if (File.Exists(file))
                {
                    StiReport report = new StiReport();
                    report.Load(file);

                    string folder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                    folder = Path.Combine(folder, "Stimulsoft\\CompiledReports");
                    folder = Path.Combine(folder, System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion().ToString());
                    string compiledReportFile = Path.Combine(folder, report.GetReportAssemblyCacheName());


                    if (File.Exists(compiledReportFile))
                    {
                        lbStatus.Text = "Loading report from assembly";
                        Application.DoEvents();
                        report = StiReport.GetReportFromAssembly(compiledReportFile, true);

                        RegData(report, (string)tvReports.SelectedNode.Tag);

                        lbStatus.Text = "Rendering report";
                        Application.DoEvents();
                        report.Rendering += new EventHandler(OnRendering);
                        int tick = Environment.TickCount;

                        report.Render(false);

                        btTest.Text = (Environment.TickCount - tick).ToString();
                    }
                    else
                    {
                        lbStatus.Text = "Loading report";
                        Application.DoEvents();

                        RegData(report, (string)tvReports.SelectedNode.Tag);

                        lbStatus.Text = "Compiling report";
                        Application.DoEvents();

                        if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);

                        report.Compile(compiledReportFile);

                        lbStatus.Text = "Rendering report";
                        Application.DoEvents();
                        if (report.CalculationMode == StiCalculationMode.Compilation)
                        {
                            report.CompiledReport.Rendering += new EventHandler(OnRendering);
                        }
                        else
                        {
                            report.Rendering += new EventHandler(OnRendering);
                        }
                        int tick = Environment.TickCount;
                        report.Render(false);
                        btTest.Text = (Environment.TickCount - tick).ToString();
                    }

                    if (!report.IsStopped)
                    {
                        if (reportAction == ReportAction.PreviewInWindow)
                        {
                            report.Show(true);
                        }
                        else if (reportAction == ReportAction.Preview)
                        {
                            stiViewerControl1.Report = report;
                            //stiViewerControl1.FirstPage();
                        }
                        else if (reportAction == ReportAction.Print) report.Print();
                    }

                    lbStatus.Text = "";
                }
                else MessageBox.Show("'" + tvReports.SelectedNode.Tag as string + "' not found");
            }
        }
This is method from Demo application. If report is changed or version of report generator is changed then report engine will generate new report assembly.

Thank you.
dikan
Posts: 202
Joined: Thu Jun 18, 2009 5:05 pm
Location: Serbia

GetReportFromAssembly did not work

Post by dikan »

I know that new version needs recompiling so I did that long ago before I started this thread.
I believe that this is not my problem. In this very moment I do not know where to look but something will come up.
If I have some question during my investigation I will ask you. :redeye:

Regards,

Djordje
Post Reply