Visual Studio 2005 Dropping Out of Debug (After IE8 Installed)

Had this issue and wanted to pass it on:

IE 8 has a feature called Loosely-Coupled Internet Explorer (LCIE) which results in IE running across multiple processes.

http://www.microsoft.com/windows/internet-explorer/beta/readiness/developers-existing.aspx#lcie

Older versions of the Visual Studio Debugger get confused by this and cannot figure out how to attach to the correct process. You can work around this by disabling the process growth feature of LCIE. Here’s how:

  1. Open RegEdit
  2. Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
  3. Add a dword under this key called TabProcGrowth
  4. Set TabProcGrowth to 0
    Since you are running on Windows Server 2003, this is all you should need to do. If you run into the same problem on Vista or newer, you will also need to turn off protected mode.

Credit: Brad Sullivan, Program Manager, Visual Studio Debugger, MSFT

To turn off protected mode in Vista, it is the checkbox on the Security tab under Tools -> Internet Options.

LINQ (Language Intergrated Query)

LINQ is a new type-safe query structure available in C# 3.0 and .NET 3.5 Microsoft framework.  With LINQ you can query against any collection that implements IEnumerable<> or remote data sources.  With this, LINQ benefits from compile-time checking and dymanic query composition.  To use LINQ include the following namespaces from System.Core assembly:

System.Linq
System.Linq.Expressions

LINQ consists of 2 basic data units, sequences and elements.  A sequence is defined as any object implementing the IEnumerable and elements are any item within the sequence.

To transform a sequence you use a method called query operator, which typical accept an input sequence and produce an output sequence.  The IEnumerable class in LINQ has around 40 or so query operators that are refered to as standard query operators.

A standard query expression would look as follows:

C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace LINQSample
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] query = { "I", "Was", "Here" };  //String collection to query
            IEnumerable<string> filteredQuery = query.Where(n => n.Length >= 1);  //query with lambda expression.
            foreach (string q in filteredQuery)
                Console.Write(q + " ");
        }
    }
} //Console output: I Was Here

Polymorphism the C# meaning

Through inheritence a class can be more then one type and this is referred to as polymorphism. Within C# all types are polymorphic, because it treats every type as an Object.

The Microsoft definition is as follows:
“Through inheritance, a class can be used as more than one type; it can be used as its own type, any base types, or any interface type if it implements interfaces. This is called polymorphism. In C#, every type is polymorphic. Types can be used as their own type or as a Object instance, because any type automatically treats Object as a base type.

Polymorphism is important not only to the derived classes, but to the base classes as well. Anyone using the base class could, in fact, be using an object of the derived class that has been cast to the base class type. Designers of a base class can anticipate the aspects of their base class that are likely to change for a derived type. For example, a base class for cars might contain behavior that is subject to change when the car in question is a minivan or a convertible. A base class can mark those class members as virtual, allowing derived classes representing convertibles and minivans to override that behavior.”

The basic “meaning” by the above statement is all C# types are derived from System.Object which allows them to be “morphed” into any type.

Using wsDualHttpBinding and recieve “HTTP could not register URL http://+:8000/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).” Error on the Web Client

This error is cause by the the clientBaseAddress URI not having elevated premission to create the listener port in IIS.

To fix this issue by using identity impersonation and add/update the follow web.config keys:

<identity impersonate="true" />

Then you can configure impersonation any way you would like.

OpenXML: XML parsing error: Reference to undeclared namespace prefix:

I ran into a small issue using an XML document type in SQL 2005 from BizTalk 2006 R2 and it turn our to be a namespace pass in from the sp_xml_preparedocument statement in my stored procedure.

You need to set it up as follows:
EXECUTE sp_xml_preparedocument @idoc OUTPUT, @xmlMessage, ‘<root xmlns:ns1=”http://namespacename” />’

The ‘<root xmlns:ns1=”http://namespacename” />’ being the most important part as this defines the namespace from the first part of your message.

Then your OPENXML call can be set up using the namespace – i.e /ns1:<node> etc.