I'm using Visual Studio 2015, and when I hit a breakpoint, I cannot get any info on the values of variables.
When hovering over a variable, nothing comes up.
In Immediate Window or Watches, I get:
error CS0648: '' is a type not supported by the language
This happened all of a sudden, as it used to work until yesterday.
I've tried a few things including resetting all user settings, deleting *.user files, restarting Visual Studio, and even restarting Windows.
What else can I try?
Update: I've written a blog post about this problem and how to reproduce it.
You won't believe this but it seems that this is somehow related to a const expression I had. Removing const and using a variable solved the problem.
How weird. Didn't manage to reproduce on a simple console application. The problem originally occurred on an ASP .NET 5 Web Application.
Update: see more details in my blog post which also explains how to reproduce the issue.
This is a bug currently being tracked by aspnet/Home issue #955.
Console Application repro for reference:
REPRO
Open VS2015 (Windows 10, ASP.NET 5 Beta 7)
Click File > New > Project > Web > Console Application (Package) > Ok
Edit Program.cs to reflect code snippet below.
Add a breakkpoint just after Console.WriteLine(a);
Run the project
Right-click variables a and b click Add Watch
CODE
public void Main(string[] args)
{
const int a = 3;
int b = 4;
Console.WriteLine(a);
}
EXPECTED
Watch window displays values for variables a and b
ACTUAL
Watch window Value column for variables a and b displays:
error CS0648: '' is a type not supported by the language
NOTES
The value of a is written correctly to Console
Removing const from the snippet reverts to EXPECTED bevahiour
I had one variable that had CONST and once I removed that all my types showed up and had values in them.
Related
I'm following along with the Contoso University and I'm running into the HP Computer Platform issue mentioned in this SO question about the scaffolding creation error saying deps.json does not exists in a certain folder.
I'm running Windows 7 Professional and using Visual Studio 2017 Community.
I have changed my Environment Variable, Platform, from BPC to nothing by using set Platform= in command prompt.
Still I get an error when I try to Right Click on the Controllers folder > Add > New Scaffolding Item... > MVC Controller with views, Using Entity Framework > Fill out the form by picking a Model class and Data context class > Add >
Error
There was an error running the selected code generator:
'The specified deps.json [C:\...\bin\BPC\Debug\netcoreapp1.1\ContosoUniversity.deps.json] does not exists'
I have tried cleaning cleaning the solution, restarting Visual Studio 2017, and rebooting my computer to no avail.
Not sure what else I should do to prevent this error. Any suggestions? I feel like copying the files into the BPC folder is a workaround, but not the best solution.
Edit 1
I noticed that the Environment Variable, Platform, got reset to BPC, so I deleted it and rebooted again. Didn't come back.
Now when I try to create the scaffold I get this error:
Error
There was an error running the selected code generator:
'Value cannot be null.
Parameter name: connectionString
at
Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b_6_0()
at
Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at
Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)'
Edit 2
Setting the Platform variable back to BCP manually brings back the original error.
Copying and pasting all files from ...\ContosoUniversity\bin\Debug\netcoreapp1.1\ to ...\ContosoUniversity\bin\BCP\Debug\netcoreapp1.1\ gets me past that error, but the error from Edit 1 comes back.
Seems I have two separate problems.
Turns out I made a typo in appsettings.json
I had "ConnectionString" instead of "ConnectionStrings" with an 's'
That was causing my Value cannot be null. Parameter name: connectionString error
So, to solve my original problem, follow these steps for Windows 7. (10 shouldn't be much different):
Windows key > Right click on Computer > Properties > Advanced system settings > Environment Variables... > Under System variables find Platform > Highlight Platform > Delete > OK
make sure .json file exists in path specified. and let me know about that what you find.
I am working on .NET CORE 1.0 MVC 6 application and I stuck with the debugging point as it stopping hitting yesterday. with number of try I delete project and start again. First time it load symbols even due I have uncheck in Tool --> Debugging --> symbols, however it hit breakpoints. Now it only hitting C# class 'Startup.cs' if I choose 'Enable Just My Code' but in controller. I have Debug option from dropdown, not really sure why. Need help here.
I change as
Select Debug->Options->Debugging->General
Tick Enable .NET Framework source stepping.
but still no success
Module
Trying to Hit in Controller home class for MVC Core in Index and about
public class HomeController : Controller
{
public IActionResult Index()
{
var x = 2 + 3;
return View();
}
public IActionResult About()
{
var x3 = 2 + 6;
var xx = "dd";
ViewData["Message"] = "Your application description page.";
return View();
}
Debugging output
actually your screen shot was not the debug output, it was the build output.
If you disable the "Enable Just My Code", and enable/disable the Microsoft symbols Server under TOOLs->Options->Debugging->Symbols, and then debug your app after you re-open it, how about the result?
If I create a new app, the breakpoint was hit normally, if I re-open the solution, actually it still could hit the breakpoint, but it is very slow. Like the screen shot 1, if you visit the "debug" output window, it would list the symbols loaded one by one, after about 1min, it would hit the breakpoint like screen shot 2. Of course, I enabled the Microsoft symbols under TOOLS->Options->Debugging->Symbols and disabled the Enable Just My Code for the above steps.
So for your issue, one possible reason is that it just loads the symbols slowly, just wait for a moment.
While Jack Zhai-MSFT's solution worked I still had some weird behavior: breakpoints were working partially. Found solution here that works perfectly: Breakpoint Failed to Bind - Visual Studio 2015
While the above link is loaded with tons of solutions in my case changing configuration from Release to Debug under Build menu Configuration Manager solved all my breakpoints related problems.
I thought I was running into this same behavior except in my case it was caused by Temporal Coupling in the Startup.cs class of my .NET Core MVC application.
I had included my app.UseMiddleware() call below my app.UseMvc() call and because of this my middleware component would initialize but was never hit by requests coming into my application. Moving my call to app.UseMiddleware call above the app.UseMvc call fixed this and now my requests are being properly routed through my custom middleware.
app.UseMVC MUST BE THE LAST "app.Use()" call in the Configure method of your Startup.cs class
I faced the same problem and none of the above solutions worked.
Finally I figured out below setting works like a charm.
Go to Tools->Options->Debugging->General->Uncheck "Use Managed Compatibility Mode" checkbox
Worked for me by enabling following Debugging option "Enable .Net framework source stepping"
This solved my problem
-> Close visual studio. -> Deleting .vs folder reopen visual studio. Doing this solved the problem breakpoint couldn't be hit
I am not able to get android studio display the value of a calculation in the watches window.
I use Kotlin for development and when i try to add a value to watches, i get a message which says "An exception occurs during evaluate expression".
e.g.
val model = MyModel()
val pos = model.position
Now if I add model.position to watches, then it gives the above error and the value of the expression is not displayed.
How can I fix this?
That's bug in Android studio.
1) I've reported mentioned bug (or very similar) recently:
https://issuetracker.google.com/issues/62859634
2) If you find a bug in tools, report it to Google:
https://issuetracker.google.com/issues/new
This bug should be already fixed in new Dex compiler.
Try to enable it by adding:
android.enableD8=true
to your gradle.properties.file
For more details check official blogpost.
file> invalidate caches / restart .. fixed it for me
I have an firefox extension with the name myjavascriptfile.js,As I am new to this addon concepts,just I want to debug this script.So I am using the following statements in this file like
function LOG(text)
{
var consoleService = Components.classes["#mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
consoleService.logStringMessage(text);
}
observe: function(subject, topic, data)
{
LOG("observe called ");
}
I know this observe is getting called but I dont know where to see my log message.can some one tell me Where it is printing?
Please help.
That text goes to the Error Console. You might need to go to about:config and change devtools.errorconsole.enabled preference to true - the Error Console was removed from the menus by default while ago (strangely enough, I could still see it even without this pref). I think that on OS X you can still open the Error Console via Tools / Web Developer menu, on Windows you have to click the Firefox button and choose Web Developer menu there. Alternatively, Command-Shift-J should do as well.
since moving to Windows 7 (IIS 7.5), the debug assertions do not prompt a pop up dialog anymore.
I have tested this in a separate project, and noticed that they do work when using the integrated Visual Studio Developer server (Cassini) but they do not work when using IIS Web Server.
This is a big issue for us since we are counting on debug assertions to identify potential programming errors, so any help would be appreciated.
Thanks. Eyal.
That's because failed debug assertions are displayed in the Output window now instead, under the Debug section.
To view the Output window in Visual Studio 2008 go to the 'View' menu and click 'Output'.
I also find it inconvenient. Some more info...
You can work around by using
System.Diagnostics.Debugger.Launch();
You can make for example this function
[Conditional("DEBUG")]
public static void AssertEx(bool condition, string message)
{
if (condition) return;
System.Diagnostics.Debugger.Launch();
// Still write the message on output
Debug.Fail(message);
}
and get similar results.
That is the default behavior now and it cannot be changed.
What you can is generate a file with the assertions that failed in your app. That will still help you track your issues without halting the app when running inside the IIS.
Take a look at this good article about it.