visual-studio 显示可视化工具错误“无法加载此自定义查看器”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2511798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Show Visualizers Error "could not load this custom viewer"
提问by LionSoft
When I try to inspect DataSet by standard DataSet visualizer I see this error "could not load this custom viewer". I wrote simple dataset visualizer, but error throws anyway too.
当我尝试通过标准 DataSet 可视化工具检查 DataSet 时,我看到此错误“无法加载此自定义查看器”。我写了简单的数据集可视化工具,但无论如何也会抛出错误。
On other computers with the same configuration visualizer show without any errors.
在具有相同配置可视化工具的其他计算机上显示没有任何错误。
OS: Windows 7 x86 (Release)
操作系统:Windows 7 x86(发行版)
VS: Visual Studio 2010 RC
VS:Visual Studio 2010 RC
has somebody any ideas?
有人有什么想法吗?
I reinstall VS with no effect.
我重新安装 VS 没有效果。
采纳答案by LionSoft
I found workaround! I changed source code of DevExpress module and recompile it. After that I undo parameter to NetFx40_LegacySecurityPolicy enabled="false", and enjoy. :)
我找到了解决方法!我更改了 DevExpress 模块的源代码并重新编译它。之后,我将参数撤消到 NetFx40_LegacySecurityPolicy enabled="false",然后享受。:)
File is "%DeveloperExpress.NET%\Sources\DevExpress.Data\Utils\Security.cs"
文件是“%DeveloperExpress.NET%\Sources\DevExpress.Data\Utils\Security.cs”
using System;
using System.Security;
using System.Security.Permissions;
namespace DevExpress.Data.Helpers {
public static class SecurityHelper {
public static bool IsPartialTrust {
get {
return !IsPermissionGranted(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
}
}
public static bool IsPermissionGranted(IPermission permission) {
bool result = true;
/* (changed by Lion)
try {
PermissionSet ps = SecurityManager.ResolvePolicy((System.Security.Policy.Evidence)null);
ps = ps.Copy();
ps.AddPermission(permission);
ps.Demand();
}
catch (SecurityException) {
result = false;
}
*/
return result;
}
}
}
回答by Dimple Bodgal
Try the following.
请尝试以下操作。
-Go to Tools->options->Debugging->Plz Uncheck "Use Managed Compatibility Mode"
Tools-转到-> options-> Debugging-> 请取消选中"Use Managed Compatibility Mode"
- Done
- It Works 100%
- 完毕
- 它 100% 有效
回答by Klepto
I had the same issue in VS 2015 and none of the answers here helped me but I found an issue on githubthat described my problem.
我在 VS 2015 中遇到了同样的问题,这里的答案都没有帮助我,但我在 github 上发现了一个问题,描述了我的问题。
The solution, or workaround might be more accurate, for me was to turn off the option "Use the legacy C# and VB evaluators" that I (apparently) had turned on in Tools -> Options -> Debugging -> General.
解决方案或解决方法可能更准确,对我来说是关闭我(显然)在工具 -> 选项 -> 调试 -> 常规中打开的选项“使用旧版 C# 和 VB 评估器”。
回答by Klepto
For me. Visual Studio 2010 restart helped.
给我。Visual Studio 2010 重启有帮助。
回答by JaredPar
The best way to diagnose this is to debug Visual Studio itself. Try the following
诊断此问题的最佳方法是调试 Visual Studio 本身。尝试以下
- Get Visual Studio into the state where you want to use your Visualizer
- Attach another version of Visual Studio to the original one (managed only)
- Disable Just My Code (Tools -> Options -> Debugger -> uncheck "Just my Code")
- Go to Debug -> Exceptions
- Check the Throw box for "CLR Exceptions"
- Switch back to the first VS and Attempt to show your Visualizer
- 使 Visual Studio 进入要使用 Visualizer 的状态
- 将另一个版本的 Visual Studio 附加到原始版本(仅限托管)
- 禁用仅我的代码(工具 -> 选项 -> 调试器 -> 取消选中“仅我的代码”)
- 转到调试-> 异常
- 选中“CLR 异常”的抛出框
- 切换回第一个 VS 并尝试显示您的 Visualizer
This should throw an exception which will then show up in the second instance of Visual Studio. Please post back with this information if it's not enough to solve your problem.
这应该会引发异常,然后该异常将显示在 Visual Studio 的第二个实例中。如果这些信息不足以解决您的问题,请将此信息发回。
回答by Parmar Hiren
I had the same issue in VS2017, I tried a lot but nothing was worked and finally, I reset all the VS settingswhich I made and the error was gone.
我在 VS2017 中遇到了同样的问题,我尝试了很多但没有任何效果,最后,我重置了我所做的所有 VS 设置,错误消失了。
https://blogs.msdn.microsoft.com/zainnab/2010/07/16/reset-all-your-development-settings/
https://blogs.msdn.microsoft.com/zainnab/2010/07/16/reset-all-your-development-settings/
回答by Tony D
For me, I had written my own visualizer for a type that I had created. Apparently, this was interfering with VS 2017's ability to display the built-in visualizer for datasets. Once I removed my own visualizer and the Microsoft Debugger Visualizer reference, I could use the built-in ones.
I have written other visualizers in earlier versions of VS that didn't cause any problems.
对我来说,我为自己创建的类型编写了自己的可视化工具。显然,这干扰了 VS 2017 显示数据集的内置可视化器的能力。一旦我删除了我自己的可视化工具和 Microsoft Debugger Visualizer 参考,我就可以使用内置的了。
我在早期版本的 VS 中编写了其他没有引起任何问题的可视化工具。
回答by LionSoft
I found the cause of this error. According this advice http://go.microsoft.com/fwlink/?LinkID=155570I add to devenv.exe.config this parameter NetFx40_LegacySecurityPolicy enabled="true"and with this parameter in .config file I have the error when try to open DataSet visualizer.
我找到了这个错误的原因。根据这个建议http://go.microsoft.com/fwlink/?LinkID=155570我添加到 devenv.exe.config 这个参数 NetFx40_LegacySecurityPolicy enabled="true"并且在 .config 文件中使用这个参数我在尝试时出错打开数据集可视化工具。
When I remove this parameter all became ok. Execption "The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag" fixed too.
当我删除此参数时,一切都变好了。Execption“AppDomain 的安全状态被配置有 NoSecurityChanges 标志的 AppDomainManager 修改”也已修复。
But I NEED NetFx40_LegacySecurityPolicy enabled="true"parameter to work with old projects.
但我需要NetFx40_LegacySecurityPolicy enabled="true"参数来处理旧项目。
回答by Amit Poonia
visual studio -> Tools-> options-> Debugging-> "Use Managed Compatibility Mode" - uncheck this and it's works fine then.
Visual Studio -> 工具 -> 选项 -> 调试 -> “使用托管兼容模式” - 取消选中此项,然后它就可以正常工作了。



