Is it possible to have the entire contents of a class that tripped an error included in the stacktrace? - asp.net

A lot of time can pass between the moment a stack trace is generated and the moment the stack trace is thoroughly investigated. During that time, a lot can happen to the file in question, sometimes obscuring the original error. The error might have been fixed in the meantime (overlapping bugs).
Is it possible to get Stacktraces that show the offending file at the time of the error?

Not elegantly, and you normally don't want the user browsing through code that's throwing unexpected exceptions anyway (open door to an attacker).
Usually, what happens in a dev shop is that the user reports an error, stack trace, and the build it occurred on. As a tester, you can grab that build from your archives (you ARE keeping an archive of all supported releases somewhere handy, RIGHT?), install, run, and try to reproduce the error, working with the user to provide additional info as necessary. I've seen very few bugs that couldn't be reproduced EVENTUALLY, even if it required running the program against a backup of the user's production database to do it.
As a developer, you can download that build's source code from your version control repository (you ARE using version control, RIGHT?), and examine the lines in the stack trace to try to discover the problem by inspection, and/or build and run it to reproduce the error. Then, you go back to the latest source version, build, and run the same steps (a UI automation system can help out here), and if you don't get the error, someone else already found and fixed it. If you still get the error, you also got an updated stack trace with lines that match the current build, allowing you to set your breakpoints and step through.

What KeithS said, plus there are ways to capture more helpful state information at the time of the Exception using the Exception.Data property. See http://blog.abodit.com/2010/03/using-exception-data-to-add-additional-information-to-an-exception/

While KeithS' answer as pretty much correct, it can be easier and more elegant than you think. If you can collect a dumpfile (instead of just a stack trace), you can use a Symbol Server and Source Server in combination with your debugger to automatically pull your correct-version code from source control.
For example: if you enable PDB output and source-server integration in MSBuild, and upload the resulting PDBs to a symbol server, Visual Studio can automatically load the correct source control from a TFS or SourceSafe repository based on the information in a minidump.

Related

Object Reference error on build but... no location?

It's an aspx web site. It's Huuuge. Oftentimes, we won't see errors until building the entire site. But it's always told us where the error is.
This time, I'm getting an Object reference not set to instance of an object. error with file, no line, no location. Double clicking on the error just does... nothing.
Error 3 Object reference not set to an instance of an object.
I've tried a few things that I've found here and elsewhere but nothing seems to be helping out or giving me more information. I've tried change the verbosity of compiler/build messages but those goggles don't seem to help.
Edit: Very specifically, the first time I try to build the site after opening the project, it says it builds just fine. Trying to build it again causes the error. Closing VS (2013) and reopening the project allows a first time build success and subsequent builds are failures. It should also be noted that it's not actually building anything because it completes far far too quickly - almost instantly.
Can anyone give me some ideas on how to track this down?
It turns out that the VS installation is completely broken. Banging on the keyboard like a monkey and then trying to build succeeds when it should not.

MVFS error in a snapshot view after upgradation of ClearCase

I created a snapshot view using Rational ClearCase explorer.
After creating it, I set the config specs, environmental variables and later tried compiling my code and got an MVFS error which says:
Unable to determine if the current working directory is in MVFS - no such device or address
When I searched the IBM website for the sake of eliminating this error, I found out that a snapshot view does not use the MVFS !
Why am I getting this error when Snapshot view does not use MVFS?
When this issue got triggered: Actually in our project we were using a ClearCase (8.0.0.7 version). We never had problems when we tried to build our code on the 8.0.0.7 version. It was only after upgrading this version to 8.0.0.15 that the build issue has arisen. The legacy of both old and new ClearCases are baseClearcase
Some more specifications regarding the issue:
The server which we are using is a Windows 2003 server. I am creating a snapshot view in H drive (NTFS drive) as C drive is not available for use in our project, cleaning the previously built files by running the shell script clean_view.sh and then compiling our C code with the ClearCase command clearmake.exe all. Previously we used to follow the same procedure where build used to succeed, but now the same has become an issue.
This question is an extension to the question which I have asked previously. I am re-posting this question as a whole thing again in order to give more clarity about the issue and also for more number of ClearCase experts to chime-in. Kindly do not treat this as a duplicate one or force close it as my issue has not yet been resolved. Also please note that this is the first time I am working with ClearCase.
LINK FOR THE PREVIOUS QUESTION: MVFS error in a snapshot view
Recently there was a development in the solution of this issue !! We escalated this issue to IBM with the help of our client. They suggested us to use Dynamic views and we used them. To our surprise it was working fine and we are able to generate the executables. But the fact still remains that we are not able to use snapshot views !!
NOTE: This comment is just to share my knowledge and experience regarding this issue. :)
While a snapshot view isn't in the MVFS, clearmake has MVFS-specific functionality for build auditing.
You mentioned that the "H" drive contained the snapshot view, is H:
A local or network drive?
A drive letter created via SUBST? In this case, is the parent drive local?
Do builds in dynamic views still work?
Does the C drive exist? Is it remapped in a Terminal Server/Citrix environment?
A caveat: Windows Server 2003 is nearly a year past MICROSOFT'S end of extended support. I would recommend updating the server environment as soon as possible.
Truthfully, issues where a process fails, and the ONLY change is the ClearCase version are usually best handled by contacting IBM instead of using this venue. Not trying to shill or anything, but if it's a clearmake bug, it has to go there anyway...
Additional questions:
If the C: drive is inaccessible on the system, which is what "can't even get the properties" in the comment seems to infer, where is the OS installed? Where does %SYSTEMROOT% point?
If it worked on a different drive, what's different between those 2 drives (H: Failed and R: worked)

How do I change what Rational Functional Tester logs?

Recently my company upgraded from RFT 8.1.1.1 to RFT 8.2 and now all of our rational_ft_log.txt files that get generated from tests are at least a dozen times longer than they were before we upgraded.
These files are so much longer now because every little "getProperty on frame" that happens returns a +++Pass, like this:
++ PASS 30-Mar-2011 11:15:43.113 AM getProperty on the Frame
line_number = 50
script_name = DebugCommands.IR2_18_DebugCommands
Anyone know how to get rid of these nasty things?
I have searched exhaustively for RFT options to change, and I have looked a little into writing a plugin to output log files. I can't seem to get IBM to get back to me.
You could write your own plugin, or just create your own custom logging methods in a super helper class. I do that anyway, to give me flexibility to output my logging info to any destination. But to answer your specific question about getting rid of the extraneous getProperty log messages, see the RFT info center:
Logged events such as verification
point failures, script exceptions,
object recognition warnings, and other
additional playback information are
displayed in the playback log results.
From Rational® Functional Tester
version 8.2 and later, the results of
the getProperty() command are also
displayed in the log results. If you
do not require the log event to be
displayed in the playback log, you can
disable the event in the log results.
Before you begin: Ensure that you have
access to modify the ivory.properties
file.
About this task: To disable the
getProperty() log event, you must
modify the ivory.properties file.
Procedure: Open the ivory.properties
file available in the \Functional
Tester\bin\ directory. Add the
following line of code at the end of
the file
contents:rational.test.ft.log.enhanced=false
The fix is available under PMR29716. However, you would have to upgrade RFT8.2 to RFT 8.2.0.1 iFix01 to see it working.
Check the PMR # https://www-304.ibm.com/support/docview.wss?rs=0&uid=swg24029194

WebService Debug Synchronization (why do my breakpoints give the message "The source code is different from the original version"?)

I'm fairly new to web service development, and I am really confused about how ASP.Net Development Server synchronizes with code during debug mode. When I make changes to my service, I cannot figure out how to propigate those changes so that my client can "see" them (I've been able to synchronize through a stumbling series of publishing the service, viewing the service in browser, etc... but I have a feeling there's a more reliable system than my random ritual).
Here are the symptoms I'm seeing: After I've made a change to the code behind my service (Service1.svc.cs), started the application through the debugger and attached the debugger to the WebDev.WebServer.exe process as well, my latest changes are not executed, and my breakpoints are not hit (they have the message that
"The source code is different from the original version."
What really baffles me, though, is that when the ASP.Net Development Server notification pops up in my system tray, its physical path points to my project folder, so I don't understand how it could be looking at anything but my current code files.
I do not like to play with knives but the only thing that worked for me involves editing the .csproj file itself. So, unload the project file, edit it by cutting and pasting the three asp.net files so that they are together in the ItemGroup. However, sometimes it is necessary to go further as explained here: http://carnotaurus.tumblr.com/post/4130422114/visual-studio-debugging-issue-with-files-of-the-same - Also, I give a list of other proposed solutions that did not work for me. I hope it helps.

Decrypting the YSOD, techniques to the mayhem

How many can relate do this?
Server Error in / Application
Object reference not set to an object
Description: Object reference not set to an object.
Exception Details: System.NullReferenceException: Object reference not set to an object.
Source Error:
Line 56: posts.Add(post);
On a more serious note, what are the first things you look for when you see the
yellow screen of death? Half the time the debug trace isn't actually telling you what the problem is (understandable I guess).
I must admit, I still use Response.Write more than I should. I just get lazy going through the debugger. What techniques do you use to debug the problem?
If I'm unable to identify/resolve the issue using the error message that the page presents to me, I will typically try to use the Windows Event Viewer to help me identify what is causing the issue.
For example, SharePoint errors are sometimes far less than descriptive. So, I'll combine what I'm seeing on the Y.S.O.D. with error messages from the Event Viewer to help me narrow down the cause.
I will do my best to ask a co-worker or other associate that I think might have some experience that might help. If I'm still unable to identify the cause, I will resort to Google armed with all the information.
Here's how I try to reduce the number of YSODs. One of the first things I do when starting work on an app is to create a custom exception class.
Add properties such as the SQL
statement being run. Two display
message text fields, one for display
to users, one for display to
developers (in debug mode) Who is
the logged-in user. Get all the form
variables so you know what they were
trying to enter.
Log the errors somewhere (event log
is good, if you can access the web
server; logging to the database is
less successful when so many
exceptions are inability to access
the database).
Create code in the MasterPage or web page base class Page Error events and Application Error events to do the logging.
Create a custom error page. When in
debug mode, the custom error page
displays everything. When not in
debug mode (production), display
only selected properties of the
custom exception.
Investing the time up front to do this will save you many hours of anguish later.
I usually do my debugging on my local machine with the Cassini web server (comes with VS 2005/2008). If I see an exception on my QA or, heaven forbid, my production box it's usually because I forgot to update my connection strings so that they point to the QA/production database instead of my local machine.
In other cases, I've found the stack traces to be very helpful in determining where to provide breakpoints so I step through it in the debugger and examine the data at runtime. The only time I've written any debugging information on the page was when trying to find some performance issues that I couldn't replicate on my developer instance. In this case I wrote some hidden fields that contained timing information about various parts of the render process.
the error info provided, assuming you are in debug mode, will give you information as to what line the error actually occurred on, along with the lines of code leading up to the error. This info should give you a good start on defining where to set your break points for debugging.
I was once in your shoes many moons ago, using response.write for debugging. Once you start using the IDE and debugger as it's intended you'll find yourself pulling out less hair and getting to the solutions much faster.
Also, opening up the immediate window while debugging is gonna make your life even more happy.
Use a decent logging framework such as log4net, and be liberal in your use of DEBUG-level logging.
It's essentially a neater version of your Response.Write approach, which can be left in your production code and "switched on" when required.

Resources