2009-08-04

PLINQO! (No, not the game on Price is Right.)

My friend Tyler introduced me to PLINQO, a killer looking LINQ to SQL ORM data layer, for a side project I'm collaborating with him on.

I'm total newb to it, but I drooled when he gave me a quick crash course on how it works. It's giving me a wonderful opportunity to brush up on the LINQ skills and remember why I love .NET development so much.

I'm excited to see how it plays out for me... if I like it enough, I'll start using it in my own personal projects.

One thing I've been impressed with in the VERY short time I've used it so far, is how easy it is to pick up and run with.

How can you not like this:
public string[] GetStateEmployeeNames( int stateId )
{
string[] stateEmployees = (
from se in this.DataContext.StateEmployee
join e in this.DataContext.Employee on se.EmployeeId equals e.EmployeeId
where se.StateId == stateId
orderby e.Name
select e.Name).ToArray();

return stateEmployees;
}

It's goodness... I can't wait to see what other ease and power PLINQO will offer. Stay tuned...

2009-06-29

Ensure XHTML Strict Compliance by Removing Name Attribute from Form tag in ASP.NET

Many of us web developers are trying to be "good citizens" and conform to the higher standards of XHTML in our apps.

By default, ASP.NET will add the name="FormName" attribute to the rendered XHTML.

To force ASP.NET to omit the name attribute, simply add the following tag to the system.web section of your web.config file for your app:

<xhtmlConformance mode="Strict" />


Be warned, however; unfortunately it doesn't seem to make ASP.NET render HyperLinks properly. I have an asp:HyperLink that happens to have an ampersand (&) in the Text and ToolTip properties. The ToolTip properly renders a title="" attribute with the ampersand encoded as &amp; ... but the text between the open and close <a> tags doesn't have the ampersand properly encoded.

The only advice I can give you there is to:
1. Use the word "and" instead of an ampersand
2. Make static "a" tags instead of using the ASP.NET HyperLink object, if you can. If someone knows a smoother/quicker/more elegant solution, please leave a comment with it!

2009-04-29

"The breakpoint will not currently be hit" "The source code is different then the original version"

Today, I was debugging an ASP.NET website. I was at a breakpoint when a co-worker called me over to their desk to help with a defect they were trying to reproduce.

I needed to use remote desktop to look at something on my own machine, so I did so. While I was accessing it via remote desktop, my Visual Studio decided to crash.

Aftwerward I started seeing the following on breakpoints I was trying to hit:
"The breakpoint will not currently be hit. The source code is different then the original version"

I thought that a reboot would help, but to no avail.

After talking to another co-worker that had seen it in the past, he informed me that he fixed it by deleting all of the Temporary ASP.NET Files.

Sure enough, it worked like a champ. However, I had to shut down anything that had handles on those files (like the ASP.NET development server, Visual Studio, etc.) before I could complete the delete.

So to fix the problem:
  1. Close out Visual Studio and make sure any instances of ASP.NET development server are closed as well.
  2. Delete everything from "C:\Windows\Microsoft.NET\Framework\v.2.0.50727\Temporary ASP.NET Files" (where v.2.0.50727 is the version of the .NET Framework your site is running on.)

Hope this helps someone else... it sure helped me.

2009-03-04

Error connecting to undo manager of source file "whatever control/page.designer.cs"

I've run into this problem a couple of times where I get an error that states:
Error connecting to undo manager of source file "MyControl.ascx.designer.cs" (I've seen it with an aspx.designer.cs too.)

I don't know what the cause is, but I have a sneaking suspicion that the culprit in both of my cases was merge operations from source control interactions where, for whatever reason, my designer became out-of-sync or something with its ascx/aspx counterpart.

After searching around the net, it seemed the most popular method of correcting the problem was to delete the designer completely, then run the option to convert the project to a Web Application.

That option didn't sit right with me. I searched on.

I found an article by Scott Hanselman that discussed excluding the designer from the project, recompile, re-include, recompile again. That seemed a much more fitting solution to me; but I wondered if it could be even easier. So I tried an experiment.

My experiment consisted of simply opening the designer.cs file, typing a character somewhere in the file, deleting the new character, saving the file and recompiling.

The problem disappeared for me after that. (I will note that I cleaned the solution and rebuilt it prior to trying this, and that may be a required piece of the solution to the problem, but I would try the simple step first, then add in the clean/rebuild after.)

I'm using Visual Studio 2008 SP1. I hope this helps someone else out there.