Show Visualizers Error "could not load this custom viewer" - visual-studio

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.

Try the following.
-Go to Tools->options->Debugging->Plz Uncheck "Use Managed Compatibility Mode"

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.

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.

For me. Visual Studio 2010 restart helped.

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/

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;
}
}
}

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.

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.

Clearing Visual Studio Cache fixed it for me.
Just follow these basic steps:
Step 1: clear the Component Cache
Close Visual Studio (ensure devenv.exe is not present in the Task Manager)
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/

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

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.

Just Restart your system. Your problem will be resolved.

Related

Unable to set the next statement. The next statement cannot be changed at this time

I suddenly started experiencing this error in Visual Studio 2015 and 2017, when trying to move the yellow cursor (next statement) in debugmode.
The code I want to move over is nothing special (i.e does not include any try-catch and/or exception statements) and stepping through the code (F10, F11) works normally.
Here is a code sample:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddlCountry.SelectedIndex = 0;
ddlCountry.DataSource = new List<string>() {"Germany", "Japan"};
ddlCountry.DataBind();
}
}
The solution contains multiple web projects and console projects, but the error does not occur in the console projects - only in the web projects. I.e in the console projects, I can move the yellow cursor with no problems.
When I try to do the same in any other solution, I have no problems, so it seems to be something related to my current solution.
These are the things I tried so far:
Started Visual Studio as admin
Tried to move the yellow cursor in both vs2015 and vs2017 (same project, same file) - same result
Visual Studio 2015 repair installation
Start Visual Studio, using the following command "devenv.exe /resetuserdata", in order to try to reset all userdata
Tools --> Import and Export Settings --> Reset all settings
Deleted the .suo file
All the suggestions I found on Google have not proved very helpful in solving this issue, so if anyone here can assist, I would be really glad.
Deleting bin and obj folders from project can fix a lot of issues
I had it on vs2022, Restarting vs2022 solved it, Microsoft should fix it or at least give this solution in the error message at least.
Uncheck this (Tools --> Options)

The Diagnostic Tools window does not support debugging using the 'Script' debug engine

I am getting this message in the Diagnostic Tools window in Visual Studio 2015 when debugging a C# MVC web application.
I've checked solutions to a similar problem: Visual Studio 2015 diagnostics tool does not support current debugging configuration but using administrator mode and disabling "Use Managed Compatibility Mode" do not help. I've also tried disabling Options -> Debugging -> Just-In-Time -> Script, which still has no effect. It's the only reference I can find to 'Script' and I don't know how to change my debug engine.
I've also tried this solution from the web about setting the Visual Studio locale to the same as the OS, but they're both using US English. https://blogs.msdn.microsoft.com/devops/2015/05/06/known-issue-for-diagnostics-tool-window-in-visual-studio-2015-rc-the-diagnostic-tools-failed-unexpectedly/
Can anyone tell me what I'm doing wrong?
My error message is
The diagnostic tools failed unexpectedly. The Diagnostic Hub output in the Output window may contain additional information.
Try to modify the Environment Variable TEMP as following rules and reopen Visual Studio. That works for me, maybe it also works for you. My IDE is Visual Studio Enterprise 2015 Update 3.
It must only one path in TEMP. For example,
Fail:%USERPROFILE%\AppData\Local\Temp;C:\OTHER_PATH
Fail: %USERPROFILE%\AppData\Local\Temp\;C:\OTHER_PATH
Pass: %USERPROFILE%\AppData\Local\Temp
If you create a default MVC web app, and then debug your app, could you use the Diagnostics tool in your side? I test it in my side, it works well using the default settings, my OS and VS all are the English version. So you use the same language version, am I right?
If possible, you could check the following steps:
Reset your VS settings:
Open VS, TOOLS->Import and Export Settings Wizard->Reset all settings->select “No, just reset settings, overwriting my current settings”->Choose a Default Collection of settings(I often use the General or C#).
Please use the latest VS2015 with update 3.
Maybe you could download and install the match VS version as your windows directly, debug it again.

Keyboard shortcuts not working after process attach (Visual Studio 2013 bug during debugging)

I've written small VSIX plugin which is able to attach debugger to particular process. This process is written using c# and c++ code, so I need to attach to it using both managed and native engines. From Visual Studio it can be achieved simply by selecting these engines from window opened by DEBUG -> Attach to process... -> Select...:
Below, I've shown the code sample which basically does the same thing, using Process2.Attach2 (MSDN):
EnvDTE80.DTE2 dte = GetService(typeof(SDTE)) as EnvDTE80.DTE2;
EnvDTE80.Debugger2 dteDebugger = dte.Debugger as EnvDTE80.Debugger2;
EnvDTE80.Transport transport = dteDebugger.Transports.Item("default");
EnvDTE80.Engine[] engines = new[] { transport.Engines.Item("managed/native") };
process.Attach2(engines);
Unfortunately, the very same code which works for VS2012, doesn't work for VS2013 (Update 1).
What I've noticed is keyboard problems. Visual Studio doesn't react for pressing key shortcuts. For example, if I press F10, debugger does nothing. If I want to step over any breakpoint, I need to use mouse instead and access context menu: DEBUG -> Step Over, etc.
It's annoying, I need the keyboard to control debugger. Has anyone noticed this problem and solved it already?
BTW: If I use managed engine only (transport.Engines.Item("managed")), the keyboard starts to work correctly. But because I need to debug through unmanaged code also, I need additional engine - the native one.
EDIT: I've reported it also to Microsoft Connect network.
I've found temporary workaround. To fix that issue I opened TOOLS -> Options... -> Debugging -> General and checked Use Managed Compatibility Mode option:
What's more, this change paradoxically fixes another, seemingly unrelated issue, namely evaluation of expressions in Watch or Immediate windows for some particular cases (which I also noticed few days ago).
UPDATE:
I've detected this issue using Microsoft Visual Studio Premium 2013, Version 12.0.30110.00 Update 1
After installation of Version 12.0.30219.00 Update 2 CTP, this problem is no longer reproducible for me.
As Jarek mentioned above, this issue shouldn't repro in Update 2 CTP 2. If you are still encountering it, please reactivate the Connect bug

visual studio edit and continue does not work

In my project which is a hybrid project (in previous it was a web forms project that then we modified to use mvc pattern).
Now I want that in debug mode, I want to change something in my cs file, and
then I want the changed code to run.
I've tried enabling and disabling tools -> options -> debug -> edit and continue checkbox part.
When it is enabled I can't change code in my project while debugging.
When it is disabled I can change code but it does not affect on running part.
for example.
int i = 0;
if(i == 1)
return 1;
else
return 2;
In debug mode I changed i to 1 but it stil returned 2, in the following code, only when I stop and re-run the debugger it takes affects.
int i = 1;
if(i == 1)
return 1;
else
return 2;
BTW I am using Visual Studio 2010 version.
This wasn't my problem; running VS2017 RC2, I found that under Tools -> Options -> Debugging -> Just-In-Time - my "Managed Code" was deselected.
There was a warning "Another debugger has registered itself as the Just-In-Time debugger. Fix by enabling Just-In-Time debugging or running Visual Studio repair".
I had not registered any other debugging tools! So no idea why it unticked...
So the fix was simply to tick the "Managed" box....
None of the given answers worked. Here's what I did.
I repaired the VS installation. I had 2017 version.
I unticked the Native code checkbox.
None of the above worked for me on their own, but once I unchecked "Enable Native Edit and Continue" then it worked: under Tools -> Options -> Debugging -> General.
Under Tools -> Options -> Debugging -> General: Check the box for 'Enable Edit and Continue'.
Under Tools -> Options -> Debugging -> Just-In-Time: Check the box for 'Managed Code' Image Checking Managed Code
Save and restart Visual Studio. If you get a warning about elevated permissions, accept the dialog. Your changes are not saved yet. After restart, go again to Tools -> Options -> Debugging -> Just-In-Time: Check the box for 'Managed Code' if not showing checked. Save and restart Visual Studio.
The solution of this problem is on the Microsoft Documentation... After you enable tools-> options -> debud -> edit and continue.... There is more to do..
If IntelliTrace is enabled and you collect both IntelliTrace events and call information, Edit and Continue is disabled.
On Visual studios' menu go on Tools>>options - Select "IntelliTrace" tab and let IntelliTrace events only checked.. Save, restart the visual studio and.......
Your Edit and Continue will work again!
I discovered that my
VS2019: Project (context menu) =>
Properties =>
Debug =>
Debugger engines =>
Enable native code debugging
was turned on. After unchecking this my "Edit and Continue" issues disappeared!
Note: I had tried suggested fixes (here) prior to this discovery.
Edit & Continue doesn't work - this has fixed it for me - it's for VS2017 and started happening recently (March 2019).
It seems like NCover sets the system variable COR_ENABLE_PROFILING=1. Uninstalling it gets rid of it for me.
Repairing the VS installation, and upgrading to the current latest VS2017 version: 15.9.19 fixed the issue for me.
h-rai's answer gave me the clues I needed: unchecking the Native checkbox made a warning appear stating that another JIT debugger was registered.
Then, I found more clues in this article here
Perhaps, my issues were caused by having installed the new .NET core 3.1, but not having upgraded VS2017 to VS2019 yet.
Now, when I uncheck the "Native" checkbox, I do not get the warning about another JIT debugger, and I can modify code while debugging once again.
Before that, the Runtime Compilation was enabled by-default. For projects targeting .NET Core 3.0+ users need to explicitly enable that behavior by following the instructions https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0
install from Nuget package manager Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
Run the below command:
Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation -Version 5.0.7
and add below line in Startup file
services.AddRazorPages().AddRazorRuntimeCompilation();
If you've already updated Debug options but Edit&Continue still doesn't work, try cleaning and rebuilding the project. (worked for me in VS 2022)
Just press the Break All button, then edit your code, then press Continue.
It is work for me like a charm

VS 2010 Properties Page Fail to Show-COM object that has been separated from its underlying RCW cannot be used

I'm using Visual Studio 2010 Ultimate edition, but now it won't show the project properties page. Instead an error message show up saying
An error occurred trying to load the page.
COM object that has been separated from its underlying RCW cannot be used.
This error has plagued me for a long time. I tried almost everything (uninstall/reinstall/repair/uninstall addins, etc) except reinstall
OS.
Help me out. Thx a lot!
Finally I found out what had gone wrong. It's misbehaving addin - TestDriven.NET.
But things could be different for you. But anyway, it's addins.
The process to find this is that you Goto "Tools -> Options" dialog. Goto "Environment -> Add-ins/Macros Security" node. Uncheck "Allow add-in components to load". And then restart VS 2010 to see if the issue goes away. If it does, then it must be an addin in those folders specified. And next step is to enable addins to load, and remove the directories in the list one by one to identity which addin caused the issue. And at last, disable or simply remove/uninstall it.
Restarted VS 2010 SP1 solved my problem!!!
in my case it was the latest update of VSCommands for VS2010...
A complete UnInstall/Re-Install of the VSCommands did the job :)
This also happened to me for some unknown reason and it turned out I had to disable source-control plugin (the default one that had been happily working for a long time):
Tools -> Options -> Source control : set plug-in to "None" and restart VS.
I was facing the same issue in Microsoft Visual Studio Professional 2015 Service pack 1. I found that it was happening due to GhostDoc Community.
I upgraded GhostDoc Community 4.9.x to 5.1.x and issue get resolved in Visual Studio 2015 Service pack 1.

Resources