Show Visualizers Error "could not load this custom viewer"
Asked Answered
Q

13

26

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.

Quesnay answered 24/3, 2010 at 22:12 Comment(0)
Q
2

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;
        }
    }
}
Quesnay answered 15/5, 2010 at 9:10 Comment(1)
Can you please provide in more details on this?Filip
Z
37

Try the following.

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

Zigrang answered 27/2, 2018 at 7:23 Comment(3)
This still applies to vs2019Frances
This didn't work for me in VS2019 Pro 16.4.4. Still getting "Could not load this custom viewer." when I click on the Table Visualizer for a DataTable.Subscapular
Same for me. Still doing it.Prog
I
7

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.

Incunabulum answered 23/6, 2016 at 13:4 Comment(3)
Also didn't work for me in VS2019 pro 16.4.4. the option is already turned off.Subscapular
VS2019 Community v. 16.7.1 - I don't even see "Use the legacy C# and VB evaluators" under Debugging->General.Prog
@BillNorman If you don't see it that's likely not your problem, but it's still possible to change that under %AppData\Local\Microsoft\VisualStudio\16.0_xxxxxxxx\Settings%, in my case, I had changed that to fix another problem.Loriloria
S
6

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.

Selection answered 24/3, 2010 at 22:16 Comment(3)
Ok! It's a good idea. I did that and see the next exception: "The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag." BTW, just this exception i saw when try compile project with added to references COM-object dll. Solving that problems I not found too.Quesnay
This does not work for me. If I attach the debugger end do the rest of the specified actions, I still get dreaded "Could not load this custom viewer." window.Friday
This doesn't help. I get repeated "System.UriFormatException" errors before I can switch to the original VS2019. If I disable that exception check, I then get repeated "System.ComponentModel.Win32Exception" errors (Invalid window handle). And if I disable that, then the popup appears without an exception being thrown.Subscapular
T
5

For me. Visual Studio 2010 restart helped.

Tetanize answered 19/6, 2017 at 11:46 Comment(0)
F
3

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/

Freer answered 17/1, 2018 at 8:42 Comment(2)
Props! That did it for me!!Toothache
This is the one that fixed it for me too!Subscapular
Q
2

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;
        }
    }
}
Quesnay answered 15/5, 2010 at 9:10 Comment(1)
Can you please provide in more details on this?Filip
S
2

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.

Slow answered 9/3, 2018 at 15:29 Comment(0)
Q
1

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.

Quesnay answered 25/3, 2010 at 7:3 Comment(2)
@Quesnay I have same problem with Devexpress controls and Silverlight in same project. Any workarounds?Tumpline
Same problem here. DevExpress controls not working. Looks like we're going to have to wait for DevExpress to update their stuff.Couldst
A
1

Clearing Visual Studio Cache fixed it for me.

Just follow these basic steps:

Step 1: clear the Component Cache

  1. Close Visual Studio (ensure devenv.exe is not present in the Task Manager)
  2. Delete the directory:

%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

If step 1 doesn't work then

Step 2: cleanup your user’s temp folder. Delete this directory:

%USERPROFILE%\AppData\Local\Temp

If step 2 doesn't work then

Step 3: Delete all these directories:

%USERPROFILE%\AppData\Local\Microsoft\Team Foundation

%USERPROFILE%\AppData\Local\Microsoft\VisualStudio

%USERPROFILE%\AppData\Local\Microsoft\VSCommon

Credit : https://errorhandlinginskills.wordpress.com/2018/07/28/how-to-clear-visual-studio-cache/

Avesta answered 13/10, 2020 at 9:45 Comment(1)
That worked for me, and then reinstalling the viewer. Thanks!Deirdredeism
B
0

visual studio -> Tools-> options-> Debugging-> "Use Managed Compatibility Mode" - uncheck this and maybe it works fine then.

plz click on this link to see step by step

Blunge answered 22/1, 2020 at 6:44 Comment(2)
Assuming your answer adds current information to a 9-yr-old question, can you improve your answer by indicating as such, and also add environment and version information specific to your solution?Illhumored
This only works in a few weird cases, not in general. Saying "it works fine then" is wrong for the majority of cases.Alburg
E
0

Turn off all extension tools and restart Visual Studio to solve the problem of loading custom viewers. Then, you can further investigate the extension tools one by one and find third-party extension tools that interfere with Visual Studio

Elegize answered 4/9, 2023 at 7:36 Comment(0)
D
-1

in visual studio 2019 community after an update between 16.4.x - 16.7.5 mine was broken all I had to do was uncheck "Warn when using custom debugger visualizers against potentially unsafe processes (Managed only)" and it allowed me to see a visual of the datatable. Under the tools>options>Debugging>general menu.

Demonolatry answered 9/10, 2020 at 19:23 Comment(0)
U
-2

Just Restart your system. Your problem will be resolved.

Urn answered 5/11, 2022 at 22:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.