IE BHO为每个选项卡加载了两次 [英] IE BHO loaded two times for each tab

查看:158
本文介绍了IE BHO为每个选项卡加载了两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此示例创建IE BHO: http://code.msdn.microsoft.com / CSBrowserHelperObject-c5f3d2f6

I am creating IE BHO using this example: http://code.msdn.microsoft.com/CSBrowserHelperObject-c5f3d2f6

我遇到的问题是,每个选项卡BHO加载两次。我在BHO构造函数中插入了以下核心:

The problem I am having is that for each tab BHO is loaded two times. I have inserted following core in BHO constructor:

        Trace.WriteLine("BHO.ctor");
        Trace.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId + " of process: " + Process.GetCurrentProcess().Id);

在析构函数中:

        Trace.WriteLine("BHO.destructor");
        Trace.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId + " of process: " + Process.GetCurrentProcess().Id);

然后在Setsite中:

Then in Setsite:

        Trace.WriteLine("Bho.SetSite: " + site);
        Trace.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId + " of process: " + Process.GetCurrentProcess().Id);

当我在调试输出中启动IE时,我看到:

When I start IE in debug output I see:

[3376] BHO.ctor 
[3376] Thread: 1 of process: 3376 
[3376] Bho.SetSite: System.__ComObject 
[3376] Thread: 1 of process: 3376 
[3376] BHO.ctor 
[3376] Thread: 3 of process: 3376 
[3376] Bho.SetSite: System.__ComObject 
[3376] Thread: 3 of process: 3376

/ p>

and only when I close it:

[3376] BHO.destructor 
[3376] Thread: 2 of process: 3376 
[3376] BHO.destructor 
[3376] Thread: 2 of process: 3376 

加载两次,并且两个BHO实例同时存在。为什么会发生这种情况?

So, BHO is loaded two times and two instances of BHO exist at the same time. Why can this happen?

我发现这个问题,当我的BHO订阅从第三方汇编的事件,我经历了一些奇怪的行为(因为事件有超过1个订阅者)。首先我认为这是一个第三方库,导致这一点,但现在我从BHO中删除所有额外的代码,所以它基本上什么也仍然加载两次。

I discovered this issue when my BHO subscribed to events from third party assembly and I have experienced some strange behaviour (because there was more than 1 subscriber for the event). First I thought that it's a third-party library who causes this but now I removed all extra code from BHO so it basically does nothing but still is loaded two times.

如果在SetSite中添加OnDocumentComplete处理程序,然后在这个处理程序中我使用trace写入调试控制台的URL我看到,第一个线程URL将是我的页面的实际URL(例如www.google.com),对于第二个线程将是关于:空白。如果我再打开一个标签并在那里做一些操作,然后切换到第一个标签,我看到一个更多的BHO实例被创建(URL:about:blank)

Also if in SetSite I add OnDocumentComplete handler and then in this handler I write URL to debug console using trace I see that for first thread URL will be actual URL of my page (e.g. www.google.com) and for second thread it will be "about:blank". Also if I open one more tab and do something there and then switch to the first tab I see that one more BHO instance is created (URL: about:blank)

推荐答案

这可能是IE的完整性级别管理。

This may be IE's integrity level management.

我试图自己解决这个问题。

I'm trying to solve this myself.

我目前正在考虑:

http://blogs.msdn.com/b/ieinternals/archive/2011/ 08/03 / internet-explorer-automation-protected-mode-lcie-default-integrity-level-medium.aspx

第二个似乎消失了大约一秒左右。

The second one seems to disappear after a second or so.

这篇关于IE BHO为每个选项卡加载了两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆