Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Sunday, April 14, 2013

What is exactly structured Error Handling (SEH).

Unlike the statement like "OnError GO NEXT" in older language like VB, Structured Exception Handing is an approach in which exception handling logic has well defined scope with nesting support and exceptions are strongly typed

Tuesday, February 28, 2012

How to Read Base64 encoded WCF Data Service Response Stream

WCF Data Services by default use base64 encoding to transmit the content over the wire that that can be easily handled by most of the application out of the box, but in some scenarios it may required explicit manipulation.
I my case it was related with a message interceptor that i wrote to translated the outgoing message from Base64 encoded XML content to plain text file

Sunday, February 26, 2012

Browser is failing to render Japanese characters in Data Service response

Problem 

WCF  data services failed to display record for the several languages such as Japanese when used via Devart Data Driver . It renders some junk characters for Japanese values but English is fine, Bellow is the sample
     
 <m:properties>
        <d:CountryCode>JP</d:CountryCode>
        <d:CustomerID>JP-XX</d:CustomerID>
        <d:FullName>¿¿ ¿¿</d:FullName>
   </m:properties>

Friday, February 24, 2012

How to export loggedin user`s certificate programmatically

Problem 
You need to export of currently logged in user certificate in programmatic way.

Solution 

using System;

Monday, February 20, 2012

StyleCop if you Need Clean Code

What is StyleCop ?

StyleCop is a code styler that format C# source code as per defined rule and guidelines. Microsoft supply some standard set of rules that can be extended if required.

 It can be run from inside of Visual Studio or integrated into an MSBuild project. StyleCop has also been integrated into many third-party development tools.

It help you to find documentation issue in your code and also make you code consistent for future maintenance.

Sunday, February 19, 2012

Pex and Moles : Tool for Automated Exploratory Testing.

Note Pex and Moles will be integral par of Fake Frameowrk and shipped with VS2012
Introduction
Exploratory testing is key for the success of large project that are built on complex logic. Pex and Moles are Visual Studio 2010 Power Tools that help Unit Testing .NET applications.

This post summarize what exactly exploratory testing, how it differ from Domain Model based testing , where Pex and Moles stands for and also points to right learning  resources step by step. 

Be explicit, use Code Contracts.

What is code contract?
It is a latest set of tools and library from Microsoft that provides optimised way of validate parameters , return values and object state.

Monday, February 13, 2012

WCF Data Service: “Value cannot be null" exception while trying to select multiple columns in a $select query

Problem
You have a data service that have large number of column and you want to select only few columns but service trows

Error Stack Trace
at System.Data.Services.WebUtil.CheckArgumentNull[T](T value, String parameterName)


WCF Data Services: Select query ($select) failed for certain Column combinations with error message “Value cannot be null”

Problem
You created a WCF based data (OData) service and trying to select certain columns by using $select operator.

Error Stack Trace
at System.Data.Services.WebUtil.CheckArgumentNull[T](T value, String parameterName)

Saturday, February 11, 2012

HttpWebRequest fails after few requests and throws timeout exception.

 Problem
       HttpWebRequest fails after few (2) request and throws timeout exception

Scenario
 Sequential request: You are making sequential request for same of different urls
  webReq = (HttpWebRequest)WebRequest.Create(url);
  webResp = (HttpWebResponse)webReq.GetResponse();

  webReq = (HttpWebRequest)WebRequest.Create(url);