Saturday, October 30, 2010

Security Prompt when trying to call a webhttpbinding service method.

i was working with a webhttpbinding service which was being called from Javascript and which inturn calls a wshttpbinding service, and all of a sudden i was getting a login prompt when i was trying to invoke this new method that i created, after a while i found out that the problem, my datacontracts were not updated, it was missing a new field that i added, once i added this new field, the login prompt went away....

Thursday, October 28, 2010

WCF Performance.

http://webservices20.blogspot.com/2010/10/important-wcf-performance-issue.html and i said WOW....

Tuesday, October 26, 2010

Team Foundation Error The cache file C:\Users\Administrator\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded. Please correct or delete the file.

Fired up my VPC and tried connecting to TFS and i run into this error, i thought i need to setup bindings and working folders again....

*****************************************************************************
The cache file C:\Users\Administrator\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded.

Please correct or delete the file.
*****************************************************************************

The solution was simple get a copy the "VersionControl.config" from your fellow dev on the project and replace it, TFS internally stores all the team members source control setting in this file.

Dll is locked

We had an issue where in our dll was locked and we were unable to delete it, i thought of using processexplorer from sysinternals to look at the process, while downloading it i came across this link
http://blogs.msdn.com/b/winclient/archive/2004/07/08/177947.aspx

and the solution was :
tasklist /m thelocked.dll

Monday, October 25, 2010

Exception: New transaction is not allowed because there are other threads running

this was crazy the solution was found in the following thread

http://stackoverflow.com/questions/2113498/sqlexception-from-entity-framework-new-transaction-is-not-allowed-because-there/3902790#3902790

Reason: we cannot do savechanges while still the reader is open.

//This will fail because we are doing savechanges while the reader is open
xs= Dataservice.GetX().Where(x=>!x.Ideleted)

foreach(x in xs)
{
//do something
Savechanges()
}

//this will succed becasuse we did a tolist(which closed the reader) and then did savechanges

xs= Dataservice.GetX().Where(x=>!x.Ideleted).ToList();

foreach(x in xs)
{
//do something
Savechanges()
}

One the Primary Limitations of the DataContract Serializer.

-One the Primary Limitations of the DataContract Serializer, is it cannot do xml attributes, it always serializes in elements, contrary to this xmlserializer does attributes, which leads to small message size.

Need to Explore.

-WCFMock (should be very interesting to find how the contexts(operation,security) are tested

-AppFabric (should we be calling it B..Ta.k

-ServiceBus.

Sunday, October 24, 2010

my favorite tools

1) resharper
2) msbuild
3) debugview
4) linqpad
5) msbuildpad (imagine multiple branches)
6) Ninject

Saturday, October 23, 2010

SQL LEN function

Well, i was having an issue comparing a string retrieved from sql server and user input, the comparsion was always failing, wonder why, after debugging i found that the value in sql server had a space at the end (right), so i fired up ssms and did a LEN() function on the string, the len function result was same as what the user entered, then why was the comparsion failing, after sometime i realized that len function ignores spaces on the right, so then i used the datalength function and it gave me the correct result.

wonder why the LEN function ignores the right white spaces......

Identity Key in Entity Framework

we have a sql table with a composite key , and later on we decided to use, an Identity key so altered the table to include a new identity column (we still kept the composite key), now after re-generating the edmx, the entitycreate method was expecting an ID to be passed, but this was supposed to be autogenerated, did not have enough time to debug the issue, but after searching the net for sometime i found that you have to pass an id (can be any int), to the create method as it complains and the savechanges ovverides it with an appropriate id value, i have a todo on that and hopefully i will update regarding the issue in the future.

convert html to text.

i had the requirement to convert existing html into text, tried regular expression there are limitations to it, ex: