Show Visualizers Error “could not load this custom viewer”

ぐ巨炮叔叔 提交于 2019-11-27 23:18:03

问题


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.

On other computers with the same configuration visualizer show without any errors.

OS: Windows 7 x86 (Release)

VS: Visual Studio 2010 RC

has somebody any ideas?

I reinstall VS with no effect.


回答1:


Try the following.

-Go to Tools->options->Debugging->Plz Uncheck "Use Managed Compatibility Mode"

  • Done
  • It Works 100%



回答2:


I had the same issue in VS 2015 and none of the answers here helped me but I found an issue on github that described my problem.

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.




回答3:


The best way to diagnose this is to debug Visual Studio itself. Try the following

  • 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

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.




回答4:


For me. Visual Studio 2010 restart helped.




回答5:


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. :)

File is "%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;
        }
    }
}



回答6:


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.




回答7:


I found the cause of this error. According this advice http://go.microsoft.com/fwlink/?LinkID=155570 I 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.

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.

But I NEED NetFx40_LegacySecurityPolicy enabled="true" parameter to work with old projects.




回答8:


I had the same issue in VS2017, I tried a lot but nothing was worked and finally, I reset all the VS settings which I made and the error was gone.

https://blogs.msdn.microsoft.com/zainnab/2010/07/16/reset-all-your-development-settings/



来源:https://stackoverflow.com/questions/2511798/show-visualizers-error-could-not-load-this-custom-viewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!