“对话框”上的另一个诀窍必须是用户启动的“ Silverlight打印中的安全异常 [英] Another knack on the "Dialogs must be user-initiated" Security Exception in Silverlight printing

查看:216
本文介绍了“对话框”上的另一个诀窍必须是用户启动的“ Silverlight打印中的安全异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Silverlight中打印一些东西时,我得到臭名昭着的对话框必须是用户启动的安全异常。您可以看到,该对话框是用户启动的,可以是:





John Papa不能帮助我, / a>,因为我没有设置任何断点。 MSDN先生认为可以也是,我只是采取太长的时间,但这是一个演示应用程序,就像简单一样。



任何想法?我想这是一个Visual Studio的怪癖,也许一些扩展干扰,因为事情似乎工作,当我启动它之外的应用程序。我第一次想到也许代码合同正在干扰他们的IL编织,但是这个项目被停用了。



更新:这只是一个简单的Silverlight应用程序,文件系统。当我做开始调试时,Visual Studio在Debug中创建一个包含Silverlight应用程序的托管HTML文件。发布文件夹的项目,启动Internet Explorer与该HTML文件并附加调试器。



更新2:我也得到相同的错误,当我创建一个网页项目主持Silverlight应用程序并在IIS上为其创建一个虚拟目录。



我可能还想补充说,我在其他Silverlight项目中没有打印问题不管他们的托管情况如何。



更新3:我下载了FireFox,它的工作原理,我没有得到错误,当我调试它。所以这似乎与我的IE8有关。我上传了解决方案:



http://dl.dropbox.com/u/10401470/Code/Demos/PrintingDemo.zip



我想知道是否有人可以复制?



任何人都知道我应该向哪个团队提交错误报告? Silverlight团队? IE团队? VS Debugger团队?

解决方案

我可以重现这个。你已经处理了点击两次,一次在XAML的另一次代码。查看您的MainPage.xaml

 < Button x:Name =PrintButton
Content =Gotta print'em ! Margin =8
Click =PrintButton_Click/>

不要觉得不好。我最后一次通过一个错误的打印在循环中。


I get the infamous "Dialogs must be user-initiated" Security Exception when I try to print some stuff in Silverlight. As you can see, the dialog is as user-initiated as can be:

John Papa couldn't help me much out neither, because I don't have any breakpoint set. Mr MSDN thinks it could also be that I'm just taking too long, but this is a demo application just as simple as can be.

Any ideas? I guess it's a Visual Studio quirk, maybe some extensions interfering, as things seems to work when I launch the application outside of it. I first thought maybe the Code Contracts are interfering with their IL weaving, but they are deactivated for this project.

Update: This is just a simple Silverlight application that runs locally from the file system. When I do "Start debugging", Visual Studio creates a hosting HTML file containing the Silverlight app in the Debug resp. Release folder of the project, launches the Internet Explorer with that HTML file and attaches the debugger to it.

Update 2: I also get the same error when I create a web project to host the Silverlight app and create a virtual directory for it on IIS.

I might also want to add that I don't have problems with printing in other Silverlight projects regardless of their hosting scenarios.

Update 3: I downloaded FireFox and it works, I don't get the error when I debug with it. So it seems to have to do with my IE8. I uploaded the solution:

http://dl.dropbox.com/u/10401470/Code/Demos/PrintingDemo.zip

I wonder if anyone can reproduce?

Anyone got an idea to which team I should file a bug report? Silverlight team? IE team? VS Debugger team?

解决方案

I'm able to reproduce this. You have handled the Click twice, once in XAML another time in code. See your MainPage.xaml

<Button x:Name="PrintButton"
   Content="Gotta print 'em!" Margin="8" 
   Click="PrintButton_Click" />

Don't feel bad about it. I did it last time through a misplaced Print inside a loop.

这篇关于“对话框”上的另一个诀窍必须是用户启动的“ Silverlight打印中的安全异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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