Sign in to follow this  
sachin.mehndiratta

Unable to catch GDI+ exceptions

Recommended Posts

While working with fusion charts serversideimagehandler i was not able to catch the exceptions when process doesnot have any write permissions to target folder. I want to show this exception to user but unforunately i am not able to catch the exception.

However the type of exception is System.Exception and i have looked in to event manager to check the error message which is:

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/9/ROOT

Process ID: 10824

Exception: System.Exception

Message: Image saving failed:
A generic error occurred in GDI+.

StackTrace:    at FusionCharts.ServerSideHandlerBase.initializeObjects()
   at FusionCharts.ServerSideHandlerBase.setParameters(String swfPath, Int32 width, Int32 height, String dataXML, String dataURL, String imageFileName)
   at FusionCharts.ServerSideHandlerBase.startProcessThread(Object oSSH)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart(Object obj)


I am looking for any resolution for this.

Please suggest how to proceed on this.

Thanks,

Share this post


Link to post
Share on other sites

Hi Sachin,

 

Since this assembly creates a new thread to run  so it won't be possible to catch the error at client level, however, you can now get a response whether the operation was a "Success" for it throw any error. And using obj.GetLastError() you can get the complete Exception object which was thrown.

        // Begins the capture process.
        // An image will be created at the specified location after execution of this statement.
        ReturnValue = ssh.BeginCapture();

        if (!ReturnValue.ToLower().Equals("success"))
        {
            Response.Write("<b>Error:  </b>" + ssh.GetLastError().ToString());
        }

Please download the updated version from http://www.igcomm.com/download/ImageSaver/dotnet/FusionChartsImageSaver.zip 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this