System.Web.HttpContext not recognized

The constructor is rarely used when you want to instantiate the HttpContext class. I always use the static property HttpContext.Current which is the current instance used by all the ASP.Net application. For using it make sure you already add reference to the System.Web.dll assembly and import the System.Web namespace

Why doesn’t Visual Studio break on exceptions when debugging unit tests?

The reason why is that your exceptions are not unhandled. The unit testing framework is handling the exceptions under the hood and converting them to failures. What you need to do instead is to break on thrown exceptions. If you combine this with enabling “Just My Code” (on by default) you should get the behavior … Read more

Why is TFS ignoring a project in my solution?

Your project doesn’t have appropriate Source Control Bindings! With the solution open, you’ll need to go to File -> Source Control -> Change Source Control to view the bindings for your projects. The failing one probably will show an “Unknown” or not binded status. You can then use that dialog to correct the binding and … Read more

Determine list of event handlers bound to event

In short, you’re not meant to do this – but for debugging purposes… An event is often backed by a private field – but not with controls; they use the EventHandlerList approach. You would have to access the form’s protected Events member, looking for the object mapped to the (private) EVENT_FORMCLOSING object. Once you have … Read more

How to turn off pdb generation and vshost for all Release builds

After some digging around, it appears that project files for C# are stored in \program files\microsoft visual studio 9.0\common7\ide\projecttemplatescache\csharp\windows\1033. By adding <UseVSHostingProcess>false</UseVSHostingProcess> to the correct sections (there are separate sections for Debug and Release configurations) of the relevant templates, you can turn off the hosting process for all future projects of the selected types. You … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)