I am creating a sandbox AppDomain so I can load up an assembly and release it.
var sandbox = AppDomain.CreateDomain("Sandbox", null,
AppDomain.CurrentDomain.SetupInformation);
However when I Load an assembly into to sandbox, the debugger crashes. I am in ASP.NET.
var assemblyName = AssemblyName.GetAssemblyName(assemblyPath);
var assembly = pluginDomain.Load(assemblyName); // crash here
Anyone know why this crashes?
Can you elaborate on what you mean by "Debugger Crashes". Does Visual Studio itself crash, does the debugger just stop and returns to Visual Studio design mode, does an exception dialog popup, etc ...
For all of these cases though the first thing I would do would be to change the following debugger options and repeat the scenario.
- Tools -> Options -> Debugger
- Uncheck: Enable implicit property evaluation
- Uncheck: Enable Just My Code
I had a similar issue: Only when debugging, my program quit without any exception when accessing AppDomain. After looking in the event viewer, I saw that Microsoft.IntelliTrace.Profiler caused application errors.
The solution was disabling intellitrace:
Uncheck: Tools -> Options -> intelliTrace -> Enable intelliTrace
Related
First I enabled saving of dump files on a Windows 10 Mobile phone:
Settings > Update & Security > For developers > Save this many crash dumps: 3
Then I debugged an app which throwed an exception. I continued the debugging after stop. After disconnecting and connecting the mobile phone again, I was able to access the dump file stored under Windows phone\Phone\Documents\Debug directory. The file is called
FPCL.WIndows - a736c773-c105-4b30-a799-4bf317872f5e with exception C000027B on 5-03-2016 12.11.dmp
and has about 140 MB!
I copied the file to the bin directory of my UWP app. Afterwards I opened it as file in Visual Studio 2015 (in the same project). Now I can see the Dump Summary and I have the following buttons:
Debug with Managed Only
Debug with Mixed
Debug with Native Only
Set symbol paths
Copy all to clipboard
If I run Debug with Managed Only I get
A fatal exception was caught by the runtime. See $stowedexception in the Watch window to view the original exception information.
and on clicking Break I get
No compatible code running. The selected debug engine does not support any code executing on the current thread (e.g. only native runtime code is executing).
In the Watch 1 window I see the following
Name: {CLR}$stowedexception
Value: {"The method or operation is not implemented."}
Type: System.NotImplementedException
This should be the exception I have thrown in my app. When I open this node and look under StackTrace I can get a line number. On pressing Continue I get
The debugger cannot continue running the process. This operation is not supported when debugging dump files.
So I can only stop it.
If I run Debug with Mixed I get again
A fatal exception was caught by the runtime. See $stowedexception in the Watch window to view the original exception information.
and on clicking Break I get
kernelbase.pdb not loaded
kernelbase.pdb contains the debug information required to find the source for the module KERNELBASE.dll
Module Information: Version: 10.0.10586.218 (th2_release.160401-1800) Original Location: KERNELBASE.dll
Try one of the following options: Change existing PDB and binary search paths and retry: Microsoft Symbol Servers
Here I can either press Load or New. So the kernelbase.pdb isn't found under the given location. Should it exists? Where should I find it?
In the Watch 1 window I see the same as above and I can only stop it.
If I run Debug with Native Only I get
Unhandled exception at 0x76ECDF95 (combase.dll) in FPCL.WIndows - f736c883-f105-4d30-a719-4bf328872f5e with exception C000027B on 5-03-2016 12.11.dmp: 0xC000027B: Anwendungsinterne Ausnahme (parameters: 0x075C6838, 0x00000002).
and on clicking Break I get the same missing kernelbase error as above, but here in the Watch 1 window the Value is Unable to evaluate the expression. So I can only stop it.
According to this post I should be able to inspect the source code and find the cause. But how is such a UWP dump file inspected correctly?
You mention
[...] 0xC000027B [...]
[...] $stowedexception [...]
which are both indicators that there is a Stowed Exception inside the dump.
To analyze such exceptions, first watch Channel 9 Defrag Tools, episode 136 where Andrew Richards explains and then analyzes them (at 3:28).
Then download the PDE extension from the Defrag Tools OnDrive and analyze your dump in windbg instead of Visual Studio.
Regarding the symbols of kernelbase, they should be downloaded from the Microsoft symbol server. To set that up in WinDbg, use .symfix;.reload. If you want to give it another try in Visual Studio, go to Debug / Options and choose Debugging / Symbols, then check "Microsoft Symbol Servers".
Regarding the button to press in Visual Studio, choose "Managed only" when debugging the debug build, because your app will run on CoreCLR and choose "Native Only" when debugging the release build, because your app will use .NET native runtime support. (This applies if you didn't change the default settings; otherwise choose according to your compilation settings)
I have a problem with debugging...
All of a sudden I can't see the values of most variables while debugging.
I've managed to get two different messages in the Immediate Window:
Cannot obtain value of local or argument 'parameter' as it is not available at this instruction pointer, possibly because it has been optimized away.
and
Internal error in the expression evaluator.
I've tried and checked the following things:
Solution Configuration is set to debug (not release)
Project -> Settings -> Build -> Optimize code is not set
Tools -> Options -> Debugging -> Use Managaed Compatibility Mode (didn't work)
Do you have any further ideas how I can properly debug again? :(
Thanks in advance
Edit
The code is nothing special.. it happens when I try to watch what's inside parameter[Key]
public void AddOrUpdateQuartzJob(string jobName, IList<KeyValuePair<string, string>> parameters)
{
var jobDetail = this.GetJobDetail(jobName);
if (jobDetail != null)
{
foreach (var parameter in parameters)
{
jobDetail.JobDataMap[parameter.Key] = parameter.Value;
}
}
else
{
this.ScheduleNewJob(jobName, parameters);
}
}
The best way I've found to convince the JIT compiler not to optimize the code is to use an INI file with the name of the assembly in the same folder the assembly is in with the contents:
[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0
Note that it has to be the name of the assembly, not the name of the process EXE (unless it is the EXE assembly you want to debug). E.g. if you have an assembly MyCode.dll the INI file name would be MyCode.ini.
Here are some slides from a presentation on .Net debugging which show the difference:
With Optimization:
Without Optimization:
Go to -> Project Properties -> under Build -> set "Optimize Code" checkbox Unchecked.
Also,
Under Project Properties -> Build -> Advanced -> set the "Debug Info" dropdown to "Full" in the Options
For anyone else who was stumped on this, you may be making the same simple mistake I was: my build mode was set to Release from another project I had to build for release earlier in the day. Flip it back to Debug; problem solved.
After making the changes listed by codekaizen and isanka thalagala, do not forget to clean, rebuild and publish to make the changes effective.
I get the following exception when trying to load an ASP.NET MVC website:
Unhandled exception at 0x07070a91 in w3wp.exe: 0xC0000005: Access
violation reading location 0x00000000.
The Visual Studio Just-In-Time Debugger opens and the only information I can see in the debugger is this:
Call stack location:
msvbvm60.dll!06c00a91()
The website uses some COM objects and everything worked fine until last week. This problem appeared out of the blue.
This is the error log from Windows Event Viewer:
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7a5f8
Faulting module name: MSVBVM60.DLL, version: 6.0.98.15, time stamp: 0x4a5bda6c
Exception code: 0xc0000005
Fault offset: 0x00030a91
Faulting process id: 0x1a0
Faulting application start time: 0x01cd31fcb47f66d8
Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: C:\Windows\system32\MSVBVM60.DLL
Report Id: f5db0ae3-9def-11e1-ad79-005056c00008
Do you have any suggestions to help troubleshoot this problem?
Edit: I managed to solve the problem and now everything works. The solution involved tweaking some registry settings that the custom dlls need in order to function properly. So the problem didn't actually appear out of the blue, I just didn't realize some registry values were modified, which caused a com dll to crash.
Open the Advanced settings dialog of the Application pool that is serving the application in IIS Manager, and set: Enable 32-Bit Applications to True
The information you provided above is not enough to provide a root cause however if you can provide more info about the exception you might get exact reason for this failure. You asked for suggestion to troubleshoot this problem so here they are:
You can use either any one of the 3 tools to troubleshoot this issue:
IIS Debug Diagnostics Tool v1.2
Here is more info about how to use this tool:
http://support.microsoft.com/kb/919790
DebugDiag
Use the link below to understand how you can hook your w3wp process (it is user mode proces) with DebugDiag and collect more info about the crash:
http://msdn.microsoft.com/en-us/library/ff420662.aspx
WinDBG
Here is a link which will help you to load W3WP process in WinDBG and use some commands to extract more info about the crash:
http://blog.whitesites.com/Debugging-Faulting-Application-w3wp-exe-Crashes__634424707278896484_blog.htm
Once you have more info about the exception, you can add above and will get prompt help.
Do the Following,
1) Give full rights to Temp & %temp% folders
2) Go to application pool properties & Change " Enable 32 bit application " to true
You may start by capturing a crash dump when this issue happens again,
http://support.microsoft.com/kb/2580960
Use Debug Diag 1.2 to set up a crash rule properly is step 1.
Once you have the dump, you can use WinDbg (part of Debugging Tools for Windows) to analyze it if you are familiar with dump analysis.
If you are not capable of analyzing that, my suggestion is that you open a support case via http://support.microsoft.com and share the dumps with Microsoft support engineers.
In my case, a program called "Web Companion" was installed.
After uninstalling it, the problem was fixed.
My Solution is if you want to build it on 64bit:
Debug ==> Options ==> Search for iis ==> enable using of 64bit Version of IIS Express
This was the fix that worked for me while publishing WebAPI 7.0 to IIS on Windows 10 Enterprise Edition:
Open IIS.
Go to your Application Pool.
Right-click on it -> Advanced Settings...
Under Process Model, change Identify from "ApplicationPoolIndentity" to "LocalSystem".
Restart your IIS.
In my case, It was occurring because there was an infinite loop over the code.
I have a WCF web service (using .NET 3.5) that I am trying to debug. However, whenever I set any breakpoints in the program, they are never hit when running in debug mode. Also, no exceptions are caught by Visual Studio--normally, when an uncaught exception is thrown while debugging, Visual Studio will show the exception being thrown and take you to the line of code where the exception was thrown.
Can anyone shed some light on this issue?
Are you perhaps trying to remotely debug the service? In that case you need to run the VS Remote Debugger on the remote computer as well.
Also you should set the Service Debug Behavior in your code to get exception details, like this:
ServiceHost MyServiceHost = new ServiceHost(myService, myBaseAddress);
#if CONFIG = "Debug"
//set Service Debug Behavior (for security should not be enabled during deployment)
Description.ServiceDebugBehavior sdb = MyServiceHost.Description.Behaviors.Find<Description.ServiceDebugBehavior>();
if (sdb == null) {
sdb = new Description.ServiceDebugBehavior();
MyServiceHost.Description.Behaviors.Add(sdb);
}
sdb.IncludeExceptionDetailInFaults = true;
#endif
MyServiceHost.AddServiceEndpoint(typeof(IMyService), new NetTcpBinding(), myBaseAddress);
MyServiceHost.Open();
I'm very late with this answer, but maybe it will help someone else. You can experience this problem when you are debugging a web service that uses the local IIS instead of the Visual Studio dev server.
In this case, you must attach to the running instance of IIS, not just hit "Run". To do this, click on Debug=>Attach To Process. Then, select the Process, "w3wp.exe". Finally, select "Attach" and you should be all set.
I am trying to get crash dump debugging working with 2010, but it keeps failing.
I get this error when I try to start debugging:
"Managed Minidump Debugging: The signature verification for the file 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscordbi.dll' failed with the error 0x800700c1.:
I'm using the simplest program I can think of just to get off the ground (below).
Here are the steps I am taking:
Build
Run with a double-click from Windows explorer
right-click on the process in TaskManager, and select "Create Dump File"
kill the process
open the dump file in Visual Studio (File | Open, set filter to crash dumps)
Select "Debug with Mixed"
much loading of symbols (I have MS Symbol server enabled)
Boom (I get an error dialog saying I need to specify my symbol path -- which I believe I have done -- MS symbol server is enabled, and my solution is loaded)
In the output window, I get the following error (note that there are also a bunch of successful symbol loads, including for my exe):
Managed Minidump Debugging: The signature verification for the file 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscordbi.dll' failed with the error 0x800700c1.
(All the while, the solution with the code for my exe is loaded in the Visual Studio instance).
Any idea what I am doing wrong? Is this the right procedure for crashdump debugging in VS 2010?
The test dummy program:
class Program
{
public static string AStaticProperty = "Hello World";
static void Main(string[] args)
{
DoLoop(10000);
}
static void DoLoop(int iterations)
{
for (int i = 0; i < iterations; i--)
System.Threading.Thread.Sleep(500);
}
}
Edit
I'm going to vote to close -- I don't know exactly what the deal is, but everything is working now.
Here's what I did:
I started debugging the running process in VS 2010
I used the "save dump file" option off of the debug menu in 2010
I stopped the process and loaded the dump file.
It worked, so I thought "hmm, maybe the problem was with the dump file that I created (had used both adplus and TaskManager).
But no, now those work too. (although they failed very reliably until I did the 3 steps above). Weird, but now I cannot repro, so I'm going to vote to close.
Maybe this question/answers "Symbol issue when debugging C# code" helps you out.
The common tool used to debug dumps is WinDbg which is available in Debugging Tools for Windows. For x64 dumps you need the x64 debugger, while for x86 you need x86 debugger.
Visual Studio is x86 only, so you should not expect it can debug all dumps.
I think that this was an unstable machine/need a reboot issue. I have been unable to repro the problem