Show Visualizers Error “could not load this custom

2020-02-10 12:56发布

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.

9条回答
萌系小妹纸
2楼-- · 2020-02-10 13:11

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.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2020-02-10 13:12

Try the following.

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

  • Done
  • It Works 100%
查看更多
神经病院院长
4楼-- · 2020-02-10 13:21

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;
        }
    }
}
查看更多
smile是对你的礼貌
5楼-- · 2020-02-10 13:24

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.

查看更多
一纸荒年 Trace。
6楼-- · 2020-02-10 13:24

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.

查看更多
混吃等死
7楼-- · 2020-02-10 13:27

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.

查看更多
登录 后发表回答