Profile Picture

Strange Issue With .Net Application Using Nevrron Chart

Posted By Steve Marshall 9 Years Ago
Author
Message
Steve Marshall
Problem Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 32, Visits: 50
I have a very strange issue with my application that is running in a captive account on the server and displays our company dashboard on a screen/PC in the main office.

First, the PC connects to the server via Terminal Services and runs in a Captive Account. The screen saver for the PC is disabled, and the dashboard and the PC run 24x7. Only the screen gets turned off (if the office staff remember!)

The application runs fine all through the day and keeps refreshing and generating its PDF of the screen without issue. Sometime over the evening, however, something strange happens and I cannot explain it. The visual element of the application (that is, the display to the screen) stops working. The application process is still running, and amazingly is still generating the PDF (correctly) of the screen that does not display anymore. The actual process is still running!

Have you ever heard of such an issue before as this application was fine when the charts were displayed using the standard Microsoft charting tools, but has started doing this since switching to Nevron Chart.

The application does nothing flash, all it does is retrieve the data from the SQL Server and then pump it into the data-charts. After a refresh it takes a screen capture and generates a PDF. All pretty simple and basic stuff.

I am confused as to why the display to the screen shuts down .... would the screen being turned off cause an issue? It never has in the past, but maybe now with Chart ??

Steve


Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Steve,

This configuration is difficult to reproduce - we would recommend to use the control in off screen mode in order to generate charts if you think that it may be the cause for this problem although most likely this is Windows issue.


Best Regards,
Nevron Support Team



Steve Marshall
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 32, Visits: 50
Sorry - I am not sure what you mean by "off screen mode" ....

Thanks,
Steve


Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Steve,
We're not sure why you need to get a screen capture when you can use the control as an image server - for example:

   using (NChartControl chartControl = new NChartControl())
   {
    // configure chart

    // export image
    using (Bitmap bitmap = new Bitmap(1024, 1024, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
    {
     chartControl.ImageExporter.RenderToBitmap(bitmap, false);

     // use bitmap to save to stream, print etc.
    }
   }




Best Regards,
Nevron Support Team



Steve Marshall
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 32, Visits: 50
Hi,

The reason I take a "screen capture" is because I have several charts on the one screen (each in its own control) along with grids and other formatted elements that I generate that are not Nevron elements. I need to grab an image of the entire screen as this is the entire Divisional Dashboard, and this is what the Directors or the company want emailed to them each day when they are out of the office. AN additional factor is that this code already pretty much existed for the previous (non Nevron) version, so there was no time factor or learning curve in delivery of this.

I just thought that this was a quick and sure way of grabbing a full image of what was on the screen - all charts, all text, all grids etc... and it works. It is just that the visual element (i.e. the Form displayed to the screen) disappears overnight. The strange this is that my "screen capture" is still running and still generating a PDF file with the graphs etc in it, even though there is no Form image actually displayed to the screen. The application is still seeing the form image somehow!!

I think you are probably right and it is something else causing an issue, I just find it odd that no errors are reported, there are no application events, nothing to indicate that anything untoward has happened. All that has happened is that the display to the screen is not there, the application has disappeared as a running application (in Task Manager), has disappeared from the Task Bar, but is still running as a Process (in the Processes list of Task Manager).

I have never seen anything like this before, so I am grasping at straws trying to track what is happening as there is absolutely nothing at all to help me.

I will let you know if I find anything - and if you think that  I can generate my full screen PDF in a better way please advise.

Thanks,
Steve



Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Steve,
It's very very unlikely that the chart control can cause something like this. In any case if you suspect that it is the cause you can test whether inserting picture boxes instead of charts alleviates the issue. If so you can populate those picture boxes with off screen generated charts (like in the example above). Hope you find the reason for this problem...

Best Regards,
Nevron Support Team



Steve Marshall
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 32, Visits: 50

Hi,

Just a quick note to let you know that I believe I have solved the issue. With a little sleuthing and deduction the cause was indicating the nightly backup of SQL causing a problem that was not being handled by the application. It was strange but no error was being reported (like an unhandled exception, the visual interface part of the application was just disappearing and the application disappearing from the running applications/taskbar). Very odd. Anyway, I have coded runtime parameters into my application such that data refreshing (and therefore access to the SQL database) stops at 19:00 and then starts again at 07:00 the following morning (no, the SQL backup does not take that long!!). Hey presto, the issue has gone away. I am guessing locks taken out on the database tables conflicting with attempted access for the data refresh ,,,, quite why the Try...Catch block was not dealing with this situation I have no idea - in fact the Catch was not executing at all as I added logging and nothing was generated.

Anyhow - issue solved.

Thanks,
Steve



Steve Marshall
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 32, Visits: 50
Hi,

Apologies for resurrecting this issue, but the problem never did get properly solved and raised its ugly head with increased regularity whilst I was away on holiday. I have exhausted all my avenues of investigation now. I have coded in a quiet-time where no accesses to the database or refreshing of the controls takes place. I have coded in an automatic application restart at 03:00 so that all resources are released in case there was an issue in this area (due to the constant running of the application 24x7 - or more accurately the "attempted" running of the application 24x7). This last one seemed to make the issue go away, but purely by "masking" it in my opinion. However, this issue now seems to randomly occur during working hours after the application has only been running for a few hours.

We have several long running applications (24x7, 365 days a year) in out production facility that are developed and coded in the same way as this application and they have no issues. This is the only application that exhibits this strange behaviour, and it is the only one using Nevron Chart. Naturally, rightly or wrongly, everybody's suspicions as to the cause are falling on the new graphics package we are using (we have had this application for many years running in the same way without issue - but using the standard charting capabilities).

My last thing to try is the "using Nevron Chart in Off Screen mode" that was mentioned earlier in this thread. By this I assume you mean instantiate a Chart Control in code, configure in code, and then grab its bitmap and post to an image control on the screen, and then dispose of the Chart Control - hence Nevron is only using resources whilst the bitmap is generated. If I am wrong please correct me.

Would it be possible to see an example of this coded ?

Many thanks,
Steve




Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Steve,

Yes sure - assuming you have an image box called picture1 in a WinForm application the code should look like:

   using (NChartControl chartControl = new NChartControl())
   {
    // configure chart

    // export image
    Bitmap bitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    chartControl.ImageExporter.RenderToBitmap(bitmap, false);
    pictureBox1.Image = bitmap;
   }

Let us know if this fixes the issue...




Best Regards,
Nevron Support Team



Steve Marshall
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 32, Visits: 50
A final update. I have completely rewritten the PDF generation using PDFSharp and the issue has just gone away. It would seem that the source of this issue was the PDF library that we were using.


Steve




Similar Topics


Reading This Topic