WebProfiler is not loaded on custom environment - symfony

I'm running into a very weird issue. I have created 4 environments:
frontend_dev
frontend_prod
backend_dev
backend_prod
In frontend_dev, the profiler is shown at the bottom of the page as it should be. However, on the backend_dev environment it is not shown. Upon investigation I have found out that the piece of code to load the profiler is actually there at the body end tag, however the call to get the profiler content doesn't return anything at all.
Further investigation showed that the loadProfile method failed because $this->storage->read($token) returns NULL.
I wonder what is happening, seems like somehow the storage couldn't save the profile and thus could not read it upon request?
Edit 1:
I think I know why: previously both my frontend and my backend were using the same environment (dev) and the profiler cached the toolbar content to the same place. However, now that we are using 2 environments the profiler caches the toolbar content to backend_dev but attempts to load from frontend_dev cache folder.

I have found the reason as described above, in the end for the sake of simplicity (and also other reasons) I have separated my original app into 2 apps using this guide
So far it has worked out very well for me.

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.

Dojo treegrid runs fine locally, but not on remote server

Using dojo's TreeGrid (v. 1.9.0) served by my local machine (mvc.net) the grid loads fine with my sample, hard-coded data. However, when served from a remote machine, I get the un-debuggable "Sorry, an error occurred".
Breakpoints within my formatters are not even hit, suggesting the problem does not lie with any unloaded dependencies within a formatter. This fails not only on initial startup, but also if at runtime I try to reload the model using .setModel(myNewModel) after everything has definitely loaded. I have the firebug flag set in the dojo config object, and no informative warnings or errors are showing up in firefox...just that annoying and useless message in the grid itself.
The Sorry, an error occurred message is a result of a problem with your store and usually the data you are putting into the store.
The message is shown in DataGrid._onFetchError and TreeGrid mixes in the DataGrid.
You can
put a break point on the query engine of what ever store you are using,
analyze the data being passed into the store

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

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.

Visual Studio 2010 - Viewing lists during debug results in timeout

I am trying to debug a project, suddenly I'm running into an issue where enumerating any object collections results in a timeout if I try to view it.
If I run the program normally I have no issues. If I try to view any collection, such as a list, I get a timeout error and the whole thing bombs out.
I thought something might be going on with one of my more complex collections so I tried creating just a normal list of strings as follows...
List<string> blah = new List<string>{"fsdf","fsdg","Gt","gsersg","ser","gersgxdrsd"};
The same thing happens. I can hover over the object, I can even see the object count, however if I view the collection it dies.
I've ensured that the project/class library is in debug mode, disabled all extensions, restarted the system, tried percusive maintnence - nothing has worked.
Does anyone have any ideas? I'm completely losing my mind here.
I should also mention that this is a web application, I didn't notice before but a w3wp debug window pops up after I stop debugging. Sorry to leave out important info - was too frustrated to think straight when I wrote the post. I can still execute my code normally, and while debugging. I can examine all other objects without issue, it is only looking at collections in the watch window (or by hovering) that breaks.
Have a look at How to correctly debug web applications on local IIS 7.5 with VS 2010 Beta2?

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