We have a device running Microsoft CE v6.0 with an application running under i think around .NET 2.5.
We have a peculiar way of displaying some information on the screen of the device by using a WebBrowser
object and a locally stored html page.
Essentially we do this:
//Create a WebBrowser object
public WebBrowser htmlUserText = new WebBrowser(); // Initialization in main form
SetupInternalControl(htmlUserText, pnlCenterDisplay);
// Set up a default html file and point the web browser at it.
htmlFile = new StreamWriter("\\Temp\\HtmlText.html");
htmlFile.Write("<html><body scroll=no bgcolor = #646464><font color = #FFFFFF>");
htmlFile.Close();
htmlUserText.Navigate(new Uri("\\Temp\\HtmlText.html")); // This is a constant file we create some default stuff in it.
htmlUserText.Visible = false;
// At some point we can write some html to the file and after it is closed we do this:
htmlUserText.Refresh();
htmlUserText.Visible = true;
htmlUserText.BringToFront();
The affect in previous versions of windows ce, was that the webpage was displayed:
Here is an example html file and result:
<html><body scroll=no bgcolor = #646464><font color = #FFFFFF>lalalalalalala
Now however when i try the same thing, I get an Exception
with the following stack trace:
>Error
>Exception
>at
>Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
>at
>System.Windows.Forms.WebBrowser.Refresh()
>at ....
I have read similar questions like this, but my problem seems to be specific to this refresh, and i am not familiar with the remainder of the code and resources are opened / not cleaned up. I have also seen this but ignoring script errors doesn't do anything.
I cant step through the code since its running on an external device and has no connection to my pc. When i try catch
around the refresh()
line i get an Exception but it is not helpful at all, it has no inner exception and the message is just "Exception"
.
- Is there anything very obviously bad with they way this code was implemented. I know it may not be optimal but im not looking to change legacy code if i don't have to.
- How can i get more detailed information about why this is happening so i can track it down?
Even if remove the refresh and just navigate to and display the page, we do not get an exception thrown but the web page is not shown, we simply get a white background with nothing in it.