Visual studio form editor error - visual-studio

I have an error in my form editor preventing me from modifying the form.
I know in which control this occurs but no way to find what exactly causes the problem.
I tried setting breakpoints in the InitializeComponents() of the form I try to open but it doesn't stop (I am in debug mode...). I also tried to attach using a second instant of Visual Studio as demonstrated here, but even when setting all debug exception options to "throw", the attached process doesn't stop and indicate anything about call stack nor other useful information...
All I know is that there is a disposed object I'm trying to access, but absolutely no information as to where in code, etc..
What could I possibly do to debug the situation - knowing which control is the cause but absolutely no idea as to which of the 300 lines of code causes the issue...

Related

Xamarin + Visual Studio 2017 on Android: how debug Exception?

I have taken over a Xamarin.Forms (C#) application from an external source for fixing.
Problem is, that the application does sometimes fail with a runtime error:
System.NullReferenceException: Object reference not set to an instance of an object
The message appears in the output console and in a separate message window in Visual Studio. Unfortunately neither gives any more information about the failed object, a source code line number or a classname, there is just the bare message. Furthermore the "Call Stack" window in Visual Studio is always empty --> I have no easy way to find out where the failure occurs in foreign source code, because virtually no documentation of the program flow exists.
Full source code is available, and I have re-built the application with "Debug" configuration.
Right now the only option I can think of is to scatter breakpoints and Debug.Writelines all over the source code to get an idea where the problem occurs.
Is this really my only option, or did I miss some setting somewhere, so I can retrieve more info, so I can somehow go straight to the code where the failure occurs?
Thx!

Visual Studio 2013 crashes consistently when typing in an object/collection initiazlier?

Has anyone else ever seen this happen? I've had Visual Studio crash over and over again when typing in an object initializer: https://msdn.microsoft.com/en-us/library/bb384062.aspx
I suspect it's some kind of Intellisense bug, since it seems to occur only when the space or period key is pressed. I'm really curious what's triggering the sudden and reproducible crash and if there's any patches or workaround to prevent it from occurring.
The image shows where the cursor is when typing within the first set of brackets. This code appears in a method, which implements an interface member for the class.
This appears to have been caused by the "HideShow Comments" extension. I'm still not sure why it occurs, but disabling the plugin stops the crash from occurring and re-enabling the extension causes the crash to occur again. This must be a problem with Visual Studio itself, since it's the only common denominator in all these extension-related crashes.
I attached a debugger and caught the following error:
An unhandled exception of type 'System.NullReferenceException'
occurred in HideShow.Implementation. Additional information: Object
reference not set to an instance of an object.

Unable to determine application identity call? How to track down?

I am making a windows phone 8 application and in the designer view in both blend and VS I get "Unable to determine application identity call" error as a dialog box.
From what I read on stack this is propably because of the Isolated Storage is getting run and the designer can't handle it.
I am wondering is there away I can get some line numbers or something where the errors are happening instead of having to manually go through the code?
By the time you see this message box it is already too late, the exception was caught and handled. You have to catch it when the exception is raised. Which is not so easy to do at design time.
One technique that's worth a shot is to use a debugger to debug Visual Studio itself. Start it again and use Tools + Attach to Process. Locate the first devenv.exe in the list of processes and select it. Set the Attach to: setting to "Managed (v4.5, v4.0)" and click OK. Let it trundle to find the PDBs (takes a while). Debug + Exceptions, tick the Thrown checkbox for CLR exceptions.
Switch back to the original instance of VS and do whatever you did before to trigger the error. The 2nd instance will break in when the exception is thrown. Which some luck you'll see your code on the Call Stack window. If the debugger doesn't break then repeat the exercise but attach to XDesProc.exe, the XAML designer. Good luck with it.
Isn't this
Unable to determine application identity of the caller?
or
Getting Unable to determine application identity of the caller Error
are the same topic????
Don't know, just asking...
Sorry for any inconvenience..
Just answered in my basic question.
I'm afraid, i don't know how to get exact string number, just keep in mind that Designer cant have an access to the IsolatedStorage and check all places where you're working with IsolatedStorage. Basically, what you need to do is to add to all constructors a lines
if (ViewModelBase.IsInDesignModeStatic)
return;
If you're working with MVVM Light, or
if (System.ComponentModel.DesignerProperties.IsInDesignTool)
return;
which is pretty the same but without MVVM Light.
Also, i edited my answer there.

How to debug Dojo in browser?

I'm currently (trying) to develop an app with Worklight Studio 5.0.6 and Dojo (Mobile) 1.8.3. I have a really hard time to to find a proper method for debugging. After waiting 5-10 minutes for the build an deploy-process on the server, an error usually looks like this in the Chrome debugger:
How am I supposed to track down this error in MY source? The whole stack trace consists entirely of Dojo code which generates an absolutely useless error message after 20 abstraction layers.
Seriously, how do you guys handle this in real life? What methods do you use for debugging Dojo-driven apps in the browser?
spyro
For dojo.parse errors, I find it useful to pause the Chrome debugger on all exceptions (the purple icon on your screenshot, should be blue). You usally get more details about the cause of the error, the name of the DOM node being parsed, etc. in the first exception being raised.
RĂ©mi.
Debugging dojo based application should be the same as debugging any javascript application.
Usually I will follow these steps:
add console.log() somewhere in code: this is fast and most of time this is enough.
set breakpoint in debugger: if step 1 is not enough, you can base on error information to set breakpoint before error line, then step in or step out.
comment out recently changes: for some error which is hard to find the error line, for example, parse error in your case, the good way is comment out your recently changes one by one till back to your last working version. Or, return to your last working version, then add code back one by one.
Create a simple application to reproduce the error : if your application is very complicate and it is hard for you to follow above methods, you can try to create a new application which mimics your current application but with simple logics and try to reproduce the error.
Based on experience : Some errors, for example, extra ',' in the end of array which works at chrome and firefox, will report a nonsense error information at IE. Debug these kinds of errors is very difficult, you can base on your experience or do a google search.
Did you provide isDebug: true in your dojoConfig? Also, try to see if the same occurs in other browsers.
Update: I recently discovered that there are issues with Google Chrome and Dojo debugging and I think it has to do with the asynchronous loading of files. As you can see in the provided screenshot of #spyro, the ReferenceError object is blank (which you can notice because of the empty brackets {}). If you want to solve that, reopen the console of Google Chrome, (for example by tapping F12 twice). After reopening the ReferenceError should not be empty anymore and now you can expand that object by using the arrow next to it and get a more detailed message about what failed.
Usually what I do in situations like that is to place a breakpoint inside the error callback (line 3398 in your case) and then look into the error variable ("e").
I am not sure how familiar you are with the Web Inspector, but once you hit the breakpoint open the Web Inspector 'console' and check for the error properties "e.message" and "e.stack" (just type in "e.message " in the console).
Also, during development it is better to avoid Dojo optimization / minification, which greatly improve your debug-ability.
Bottom line is to try to place the breakpoint before the error is thrown.

Visual Studio not debugging on crash

This is driving me crazy. I'm working on a C# Forms application that is crashing for some reason when calling _documentList.Items.Clear();. For some reason, Visual Studio never catches the crash and it acts as if the application closed without any errors. I'm in the debugger stepping through line by line, and as soon as I hit the _documentList.Items.Clear();, the debugger stops and the form closes. Please help!
Edit: I've found why the app was crashing, but I'm still not sure why the debugger isn't catching it. This should have been much easier to find than it was.
I was trying to update my GUI from a FileSystemWatcher event, so I had to use this.InvokeRequired and this.Invoke(). I'm no longer getting the crash, but I would still like to know why VS isn't catching this in the debugger. My understanding is I should have been getting an exception with the message "Cross-thread operation not valid:"
I think we don't have listbox.Clear() it shopuld be listbox.Items.Clear();
Have you checked if the listbox have items before stepping into the line where you are clearing the items.
Check the items count of listbox.
It appears that this is a known issue and has been fixed when using Tasks in .NET 4.0. See this question (InvokeRequired Exception Handling) for more info.

Resources