In my asp.net application, when the retrieveObject() method in CPersistenceBroker catches an error, it uses MsgBox to display the error. MsgBox cannot be displayed without javascript in web applications. So the following error is thrown:
The error description is as follows : System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.InvalidOperationException: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options) at System.Windows.Forms.MessageBox.Show(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options) at Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title) at AToMSFramework.CPersistenceBroker.retrieveObject(CPersistentObject& obj, Boolean useFind, Boolean useCache) in C:\Documents and Settings\temp\My Documents\Visual Studio Projects\AToMSFramwork0_1_8\AToMSFramework\CPersistenceBroker.vb:line 186 at AToMSFramework.CPersistentObject.Find(CPersistentObject& obj, Boolean useCache) in C:\Documents and Settings\temp\My Documents\Visual Studio Projects\AToMSFramwork0_1_8\AToMSFramework\CPersistentObject.vb:line 765 at AToMSFramework.CPersistentObject.Find(CPersistentObject& obj) in C:\Documents and Settings\temp\My Documents\Visual Studio Projects\AToMSFramwork0_1_8\AToMSFramework\CPersistentObject.vb:line 782 at baguette.UserProfile.btnGetProfile_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\baguette\console\adm\UserProfile.aspx.vb:line 116 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain() --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I can go in and manually change the code in retrieveObject, but you might want to think about an alternative to handling the display of errors using MsgBox's, that is if this product is intended to be used by web apps as well. I havn't looked further into the other class files, but are there msgBox's used elsewhere in the AF?
thanks,
Bo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The msg boxes are left overs from original development and most exceptions should get thrown all the way back to the application. The msgbox's are only in CPersistenceBroker (6 in total) and you should be able to just comment them out for the moment and rethrow them after the rollback (where appropriate).
In terms of what will be happening next, I'm actually planning on creating proper exception types and throwing the appropriate one, instead of just the generic exception. That will make it easier in the try/catch block to handle things properly instead of having to parse an error message.
- Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi richard,
In my asp.net application, when the retrieveObject() method in CPersistenceBroker catches an error, it uses MsgBox to display the error. MsgBox cannot be displayed without javascript in web applications. So the following error is thrown:
The error description is as follows : System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.InvalidOperationException: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options) at System.Windows.Forms.MessageBox.Show(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options) at Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title) at AToMSFramework.CPersistenceBroker.retrieveObject(CPersistentObject& obj, Boolean useFind, Boolean useCache) in C:\Documents and Settings\temp\My Documents\Visual Studio Projects\AToMSFramwork0_1_8\AToMSFramework\CPersistenceBroker.vb:line 186 at AToMSFramework.CPersistentObject.Find(CPersistentObject& obj, Boolean useCache) in C:\Documents and Settings\temp\My Documents\Visual Studio Projects\AToMSFramwork0_1_8\AToMSFramework\CPersistentObject.vb:line 765 at AToMSFramework.CPersistentObject.Find(CPersistentObject& obj) in C:\Documents and Settings\temp\My Documents\Visual Studio Projects\AToMSFramwork0_1_8\AToMSFramework\CPersistentObject.vb:line 782 at baguette.UserProfile.btnGetProfile_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\baguette\console\adm\UserProfile.aspx.vb:line 116 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain() --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I can go in and manually change the code in retrieveObject, but you might want to think about an alternative to handling the display of errors using MsgBox's, that is if this product is intended to be used by web apps as well. I havn't looked further into the other class files, but are there msgBox's used elsewhere in the AF?
thanks,
Bo
Hi Bo,
Thanks for the tip.
The msg boxes are left overs from original development and most exceptions should get thrown all the way back to the application. The msgbox's are only in CPersistenceBroker (6 in total) and you should be able to just comment them out for the moment and rethrow them after the rollback (where appropriate).
In terms of what will be happening next, I'm actually planning on creating proper exception types and throwing the appropriate one, instead of just the generic exception. That will make it easier in the try/catch block to handle things properly instead of having to parse an error message.
- Richard.
Hi Bo,
I've removed the msgboxes (in CVS now) and also added a new set of atomsframework specific exceptions.
I'll release 0.1.9 soon with the new code in it. If you are in a rush, just get the code from CVS.
- Richard.