Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar) 刷新 WebBrowser 对象时出现异常
Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar) exception when refreshing WebBrowser object
我们有一个设备 运行 Microsoft CE v6.0,其中有一个应用程序 运行 我认为是 .NET 2.5。
我们有一种特殊的方式通过使用 WebBrowser
对象和本地存储的 html 页面在设备屏幕上显示一些信息。
我们基本上是这样做的:
//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();
windowsce 以前版本的影响是显示网页:
这是一个示例 html 文件和结果:
<html><body scroll=no bgcolor = #646464><font color = #FFFFFF>lalalalalalala
但是现在,当我尝试同样的事情时,我得到一个 Exception
和以下堆栈跟踪:
>Error
>Exception
>at
>Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
>at
>System.Windows.Forms.WebBrowser.Refresh()
>at ....
我读过 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 之类的类似问题,但忽略脚本错误没有任何作用。
我无法单步执行代码,因为它 运行 在外部设备上并且没有连接到我的电脑。当我 try catch
在 refresh()
行附近时,我得到一个异常但它根本没有帮助,它没有内部异常并且消息只是 "Exception"
.
- 这段代码的实现方式有什么明显的问题吗?我知道它可能不是最佳的,但如果不需要,我不想更改遗留代码。
- 我怎样才能得到更多关于为什么会发生这种情况的详细信息,以便我能找到它?
即使删除刷新并仅导航到并显示页面,我们也不会抛出异常但网页未显示,我们只是得到一个白色背景,其中没有任何内容。
事实证明这是一个非常具有误导性的错误。
CE 运行 使用的产品是 KEBA keTop 吊坠。 KEBA 在他们的机器上为 CE 发布了不同的固件和 OS 版本。升级吊坠时,我从 1.2 PRO 升级到 1.3 Standard。 标准版不包含 Internet Explorer。据我所知,IE 在查看网页时很重要 (sarcasm)。
这里的解决方案是升级到 1.4 PRO。
有趣的是,WebBrowser
异常并不知道 IE 丢失的事实。
我们有一个设备 运行 Microsoft CE v6.0,其中有一个应用程序 运行 我认为是 .NET 2.5。
我们有一种特殊的方式通过使用 WebBrowser
对象和本地存储的 html 页面在设备屏幕上显示一些信息。
我们基本上是这样做的:
//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();
windowsce 以前版本的影响是显示网页:
这是一个示例 html 文件和结果:
<html><body scroll=no bgcolor = #646464><font color = #FFFFFF>lalalalalalala
但是现在,当我尝试同样的事情时,我得到一个 Exception
和以下堆栈跟踪:
>Error
>Exception
>at
>Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
>at
>System.Windows.Forms.WebBrowser.Refresh()
>at ....
我读过 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 之类的类似问题,但忽略脚本错误没有任何作用。
我无法单步执行代码,因为它 运行 在外部设备上并且没有连接到我的电脑。当我 try catch
在 refresh()
行附近时,我得到一个异常但它根本没有帮助,它没有内部异常并且消息只是 "Exception"
.
- 这段代码的实现方式有什么明显的问题吗?我知道它可能不是最佳的,但如果不需要,我不想更改遗留代码。
- 我怎样才能得到更多关于为什么会发生这种情况的详细信息,以便我能找到它?
即使删除刷新并仅导航到并显示页面,我们也不会抛出异常但网页未显示,我们只是得到一个白色背景,其中没有任何内容。
事实证明这是一个非常具有误导性的错误。
CE 运行 使用的产品是 KEBA keTop 吊坠。 KEBA 在他们的机器上为 CE 发布了不同的固件和 OS 版本。升级吊坠时,我从 1.2 PRO 升级到 1.3 Standard。 标准版不包含 Internet Explorer。据我所知,IE 在查看网页时很重要 (sarcasm)。
这里的解决方案是升级到 1.4 PRO。
有趣的是,WebBrowser
异常并不知道 IE 丢失的事实。