Posts filed under ‘tip’

Code Coverage with TestDriven.Net in Visual Studio 2003

In VS2003 you can’t add your .exe to project reference of separate test assembly. So it is well known practice to copy it to some folder, rename to .dll and reference it from there. (Note: VS2005 allows you to reference .exe)

After performing such steps when you run Coverage from TestDriven.Net context menu, you can notice that there is coverage only for the test assembly.

Solution: Many chances you didn’t copy .pdb file for the .exe, but NCover can only profile assemblies which have .pdb files for them

Advertisements

October 30, 2007 at 11:22 am Leave a comment

Html attributes, single quote and HtmlAttributeEncode

When you develop your own custom controls do not forget that HtmlAttributeEncode method DOES NOT encode single quote.

MSDN says:

The string result from the HtmlAttributeEncode method should be used only for double-quoted attributes. Security issues might arise when using the HtmlAttributeEncode method with single-quoted attributes.

So you should use double quotes

September 11, 2007 at 11:33 am Leave a comment

Little-known C# 2.0 operator – ??

Excerpt from the msdn:

The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand.

Example:

string s = null; 
int? i = null; 
Console.WriteLine(s ?? "(null)"); 
Console.WriteLine(i ?? -1);

Will produce:

(null) 
-1

August 21, 2007 at 2:39 pm 2 comments

Links For Continuous Learners

Today I’ve spotted nice Steve Pietrek’s blog where he puts links to miscellaneous articles about .Net and related technologies

http://spietrek.blogspot.com/

August 20, 2007 at 9:44 am Leave a comment

ASP.NET Ajax, Update Panels and Response.Redirect

If your Response.Redirect doesn’t work under UpdatePanel’s callback, then you definitely missing ScriptModule in the web.config:

<httpModules>

  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</httpModules>

And now it works like a charm 🙂

August 17, 2007 at 1:33 pm 36 comments


Calendar

December 2017
M T W T F S S
« Oct    
 123
45678910
11121314151617
18192021222324
25262728293031

Posts by Month

Posts by Category