可以“ addinProcess.exe停止工作”被抑制?
我试图通过在自己的进程中启动的 MAF 插件中执行它来沙箱潜在的恶意代码:
var x = token.Activate<Ix>(new AddInProcess(), AddInSecurityLevel.Internet);
这似乎工作得很好,除了在处理 StackOverflowException 时显示一个对话框:“AddInProcess.exe 已停止工作”。这使得测试变得非常困难,
[TestMethod]
public void TestStackOverflow() {
var host = new Host(Environment.CurrentDirectory
+ "/../../../build/pipeline");
host.Run("foo");
host.Tick();
Thread.Sleep(1000);
host.Monitors.Count.Should().Be(0);
host.Shutdown();
}
如果我在睡眠到期之前单击“关闭”按钮,则测试成功,否则失败。这表明在按下“关闭”按钮之前该进程不会退出。鉴于我期望进程终止,如何确保它在不引发此对话框的情况下终止?我尝试将操作系统设置为“从不检查解决方案”,但对话框仍然出现。将其设置为“自动检查解决方案”可以避免出现对话框,但最多需要十秒钟,这是不希望的......我宁愿避免操作系统设置。
I am attempting to sandbox potentially malicious code by executing it within a MAF plugin launched in its own process:
var x = token.Activate<Ix>(new AddInProcess(), AddInSecurityLevel.Internet);
This seems to work well except that when handling a StackOverflowException a dialog is shown: "AddInProcess.exe has stopped working". This makes it very hard to test
[TestMethod]
public void TestStackOverflow() {
var host = new Host(Environment.CurrentDirectory
+ "/../../../build/pipeline");
host.Run("foo");
host.Tick();
Thread.Sleep(1000);
host.Monitors.Count.Should().Be(0);
host.Shutdown();
}
If I click the "close" button before the Sleep expires, the test succeeds, otherwise it fails. This indicates that the process does not exit until the "close" button is pressed. Given I am expecting the process to terminate, how can I make sure it does so without raising this dialog? I have tried setting my OS to "never check for solutions" but the dialog still comes up. Setting it to "automatically check for solutions" avoids the dialog but takes up to ten seconds which is not desirable... and I would rather avoid an OS setting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以调用 seterrormode 类似的addin过程:
You can call SetErrorMode somewhere inside the addin process like so: