navigation
 Monday, May 26, 2008
Read about a cool hack in Visual Studio 2008 SP1 that allows the designer to fall back on a hardcoded master page if it doesn't manage to locate the correct one.
posted on May 26, 2008  #    by John Waters  Comments [0]
 Friday, April 25, 2008
This week I needed a particular VisualStudio 2005 project template called "ASP.NET AJAX-enabled Web site" and I could not for the life of me get it to show up. Here are the steps I used to fix it.
posted on April 25, 2008  #    by Aaron Rhodes  Comments [0]
 Monday, April 21, 2008
You can't run MSI or CAB files "As Administrator" directly from the explorer in Vista, but there's a workaround.
posted on April 21, 2008  #    by Noel Rice  Comments [0]
 Tuesday, April 15, 2008
After a Vista upgrade none of my .NET 3.5 web applications would run! Visual Studio gives a "Child nodes not allowed" error for the web.config file, but there is a simple solution - once you find it.
posted on April 15, 2008  #    by Rachel Hagerman  Comments [1]
 Wednesday, April 09, 2008
How do you build a VisualStudio solution file without VisualStudio installed? Answer: MSBuild, but there is a gotchya.
posted on April 9, 2008  #    by Aaron Rhodes  Comments [0]
 Monday, April 07, 2008
My name is Angelo Martinez and I am new here at Falafel Software. I have known Lino Tadros for a long time and I can assure you that this is a great place to be! My hope is to start blogging on new ideas/tools/technologies that I discover along the way. With that in mind... I had a requirement to build a generic MRU (Most Recently Used) class based on a Key/Value pair. Among other things, the class contains methods such as Add(), Find() and a Count property that reports the number of items currently in the list. It would be nice to be able to build a set of unit tests to verify the functionality of the new class. For this, Visual Studio 2008 comes to the rescue!
posted on April 7, 2008  #    by Angelo Martinez  Comments [0]
 Saturday, January 19, 2008
One of the things I have come to love about Linq is how you can focus more on declarative programming: focusing on what you want to accomplish rather than how...
posted on January 19, 2008  #    by John Waters  Comments [0]
 Tuesday, November 20, 2007

Falafel is partnering with Microsoft to offer this free half day seminar at the beautiful Saint Claire hotel in downtown San Jose, CA to celebrate the release of Visual Studio 2008, LINQ, WPF, WCF, WF and other exciting technologies.

ActiveFocus Hosting

Please join us on December 10th from 9:00 AM to 1:00 PM
Register on the Microsoft event site ASAP as space is limited.

Charlie Calvert, the C# Community Project Manager will be there to talk about LINQ and Lino Tadros will present the usefulness of the new technologies.
Hope to see you there!
 |  |  |  |  |  |  |  |  |  | 
posted on November 20, 2007  #    by Lino Tadros  Comments [0]
 Wednesday, September 26, 2007

Wow!  I was told so many times that Visual Studio 2008 will ship in 2007, well it does not sound like that is a possibility anymore.

Microsoft released a new date, February 27th 20008 to release Windows Server 2008, Visual Studio 2008 and SQL Server 2008

2008 Global Launch Wave
963
Days
Windows Server 2008 • Microsoft Visual Studio 2008 • Microsoft SQL Server 2008
posted on September 26, 2007  #    by Lino Tadros  Comments [0]
 Thursday, August 16, 2007

I have spent the last few days trying to install Visual Studio 2008 a.k.a. Orcas Beta 2. The download page is here.

The basic idea is that you download a virtual machine that has both the OS (Windows Server 2003) and Orcas preloaded. First, you download a base file called VSCTPBase.exe, which you unpack to get a virtual hard drive. Then, you download 7 RAR files. The first one is self extracting and extracts itself and the rest of them, and then builds a differencing disk which is added to the initial virtual hard drive to create the final virtual drive. At least, that was the theory!

As the whole setup uses a lot of space, and I am almost out of space (as usual) on my laptop, I borrowed a 300 Gb external disk from work to put the VPC on. I downloaded the files mentioned above onto that disk. I then unpacked the base image, and started unpacking the 7 RARS. Well - somewhere in the middle of the third one, I get an error message saying

"Write error in the file OrcasBeta2_VSTS.vhd. Probably the disk is full."

Not! I had about 250 Gb free on the disk. OrcasBeta2_VSTS.vhd is the differencing disk that was being merged from the RARS. So, I scratched my head, googled, couldn't find anyone else with the same problem, tried downloading the file again, rebooted, tried again, sacrificed a goat. No luck.

So I tried searching for the message above as "Write error in the file" and "Probably the disk is full." Now I got lots of hits, this seems to happen a lot to people. Finally, I stumbled across a post saying that there is a file size limit on FAT32 volumes, somewhere around 4Gb.

FAT32? I had forgotten about that evil stuff, along with win.ini, config.sys, thunking, himem, edlin, floppy disks and gorilla.bas! And sure enough, the 300Gb external drive was formatted as FAT32. Duh!

So, a quick command brought my external I: drive out of the bronze age:

convert I:/FS:NTFS 

And now the extraction worked.

Can you believe that? Poor Microsoft trying to get it's developers to beta test their latest and greatest development tools, and you run into FAT32! Talk about a blast from the past. Tonight I will dream nightmares about 640K memory limits and 16 bit operating systems... and the turbo button.

posted on August 16, 2007  #    by John Waters  Comments [0]
 Tuesday, July 24, 2007

While having some fun with the Visual Studio SDK I ran across a great example of a Navigation window by Gaston Milano.  It's a great sample to start with if you would like to dive into Visual Studio Package development.  One item of note that I found while using the navigation window on a very large project is that Visual Studio 2005 kept crashing everytime the window would be brought up.  I noticed that before VS crashed it had a difficult time drawing things. I immediately thought of a GDI leak.  I opened up Task Manager and checked the GDI objects and sure enough every time I openned the window the GDI object count would skyrocket upwards, never to return to a sane GDI count again.  VS crashed after reaching a count of about 10,000 GDI objects and I don't blame it for doing that either :) 

The offending routine, the getter for the HierarchyItem::Icon property in HierarchyItem.cs, calls a method NativeMethods.ImageList_GetIcon() which merely vectors off into the win32 version of ImageList_GetIcon().  Looking at the MSDN documentation for this routine you'll notice that the remarks at the end state

"It is the responsibility of the calling application to destroy the icon returned from this function using the DestroyIcon function"

Looking at the code you'll notice that DestroyIcon is never called on the temporary HICON returned from this call so every time this routine is called I noted 2 HICONs being leaked.  And on my large project, this really started adding up.

The fix?

Change the following code in HierarchyItem.cs:

      int handleIcon = NativeMethods.ImageList_GetIcon((int)imageList, (int)index, hbmMask);
      try {
          this.icon = (Icon)Icon.FromHandle((IntPtr)handleIcon).Clone();
      }
      catch (ArgumentException) {
      }
To:
int handleIcon = NativeMethods.ImageList_GetIcon((int)imageList, (int)index, hbmMask);
try {
     this.icon = (Icon)Icon.FromHandle((IntPtr)handleIcon).Clone();
     NativeMethods.DestroyIcon(handleIcon); // <== added to destroy the temp HICON
    } catch (ArgumentException) {
    }

And add a reference to DestroyIcon in the NativeMethods class like so:

        [DllImport("USER32")]
        public static extern int DestroyIcon(int HICON);
Hope that helps any of you running into similar problems.
posted on July 24, 2007  #    by Adam Markowitz  Comments [0]
 Friday, July 13, 2007

Like many developers, I have both VS2003 and VS2005 installed on my machine. I had also placed a shortcut to the Visual Studio  command prompt in my programs menu. A couple of days ago, I had the opportunity to write my first Windows service application. I got everything set the way I wanted, and it was time to install. So, I opened up the VS command prompt, and typed in the magic chant "installutil servicename.exe". And fairly promptly got the error "Exception occurred while initializing the installation: System.BadImageFormatException: the format of the file 'servicename.exe' is invalid...".

If you're encountering the same error, make sure that you're using the correct installer. For me, it turned out that I was using the VS2003 installer. As soon as I switched to the installer from VS2005 (using the correct command prompt), everything worked just fine. It took me a while to track this down - perhaps this will save you some time.

posted on July 13, 2007  #    by Rick Miller  Comments [0]
 Thursday, July 12, 2007

While working with Visual Studio and wishing that feature X existed, I decided to delve into the Visual Studio Extensibility layer and see what it can do.  There are 3 main ways to extend the VSIDE which are Macros, Plugins, and Packages so I opted to play with managed packages (I like C# and wanted full integration into the IDE).

After downloading the Visual Studio 2005 SDK and completing development of my package I needed to deploy it.  I ran into a number of issues deploying my package, mostly related to issues with the Package Load Key.  Following are the steps that I came up with for deploying a package.

  1. Create a new VSIP membership account if you do not already have one (go to the VSIP affiliate site to sign up if you are not a member yet)
  2. Login using your passport account at the vsip members
  3. Once logged in, you must Create a new product
    1. Click on the Products link
    2. Click on the Create New Product link and fill out the information for your package
  4. After your product is created, click on the View/Request PLK link
  5. Fill in the information as it appears in your VSPackage and click the Request PLK button
  6. Microsoft will review your product and notify you that the PLK has been approved or denied
  7. If the PLK has been approved, log back into your VSIP member account, click on Products and then View/Request PLK
  8. Add a new numbered resource to your package with the PLK as its value
  9. Modify the ProvideLoadKey attribute in your package source to reference the resource number for your PLK

Microsoft requires that each deployed Package be given a key generated by and registered with Microsoft.  The generated key is called a Visual Studio Package Load Key, or PLK and must be requested from your VSIP, or Visual Studio Industry Partner, account (Note that if you are not a VSIP member you must sign up).  The PLK is a digest based on information specific to the Package that you have created (Package GUID, Package Name, Product Name, Company Name) allowing for a higher probability of unique values between packages.  The PLK also allows Microsoft to keep track of all released 3rd-party packages via their signature.  Be aware that PLKs are finicky so you must be sure to use the EXACT same information for both the Package and what was used to generated a PLK.

    Here are some useful links I came across regarding PLKs when I was getting my package ready for deployment:
    posted on July 12, 2007  #    by Adam Markowitz  Comments [0]
     Wednesday, June 20, 2007

    Today I worked on an AJAX application that uses JSON over xmlhttp to provide a quick search feature in our product ActiveFocus. Here you can see it in action: as you type in the searchbox, each time a key is pressed, the search string is sent to the server, a freetext search is done against the database, the results are returned in a JSON array, and then rendered as a HTML table:

    Originally, this was hand coded in JavaScript at a very low level, using an ASP.Net 2.0 page on the server side to create and return the JSON object. The task at hand was to convert this to a more high level approach using Teleriks RadServiceManager to call a ASP.Net 2.0 Web Service, which returns a standard .NET type that is automatically converted to a JSON object.

    In my Search Web Service, I return an array of SearchResultRows:

    public struct SearchResultRow
    {
      public int ID;
      public string ArtifactType;
      // ...
    }

    [WebMethod(EnableSession = true)]
    public SearchResultRow[] ArtifactSearch( string searchKey)
    {
      //…

    This was amazingly straight forward. On the client side, when the callback returns, you can access the array through JSON indexing, something like this:

    function CallSearch( searchKey )
    {
      Search.ArtifactSearch(
        searchKey,
        SearchServiceCompleteCallback, SearchErrorCallback);
    }


    function SearchServiceCompleteCallback(ResponseAsJSON, ResponseAsXml, ResponseAsText)
    {
      var Results = ResponseAsJSON;
      for( i=0; i < Results.length; i++)
      {
        // …
     

    After debugging it in FireFox/FireBug (highly recommended! See article by my colleague Noel), I switched back to Internet Explorer 7.0 to test it there, confident that all was well. At first, the search behaved just like it should. But when I typed a search phrase that narrowed the search down to just one record in the returned array, I suddenly found that the table of results did not get displayed at all. It would display two or more results, but not one!

    Intrigued, I switched back to FireBug to debug the mystery. But in FireFox, a one row array worked just fine. I could inspect the value of Results and see the JSON encoding, and verify that it was correct. So, I switched back to IE, this time using the VS 2005 IDE Script Debugger, which is pretty primitive compared to FireBug, but I had no choice.

    Now, when I went to inspect Results, I found something very strange. When two or more records were returned, the JSON looked just like the FireFox version:

    But when the call only returned one row, the JSON object had a different layout! Instead of a JSON  array of SearhResultRow records, there was an inner object named the same thing as the type of the array elements (SearchResultRow), which contained the field values for that one record!

    Go figure!

    At this point I had spent way too much time debugging and needed to get the job done, so I just added a check to see if the singleton format was present and handled the two different cases in seprate branches of the if statement, which did the trick.

    However, I am curious as to whether this is a bug or not. Clearly, it is the same code running both server side and client side, yet in the two main browser versions, the JSON objects differ for one record arrays.

    Let me know if you have any input! If not, maybe at least this blog will save you some debugging time…

    posted on June 20, 2007  #    by John Waters  Comments [0]
     Wednesday, May 23, 2007

    Visual Studio comes with some handy (and some not-so-handy) code snippets, but for some reason there isn't one for declaring a method. It isn't that big of a deal, but after a while you might start resenting finishing your method header, then having to type Enter, {, Enter, }, Up, Enter to start the method body. Here's a snippet that will automatically put an open and closing brace after your method declaration, with the cursor ready to go in between:

    <?xml version="1.0" encoding="utf-8" ?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
      <CodeSnippet Format="1.0.0">
        <Header>
          <Title>method</Title>
          <Shortcut>m</Shortcut>
          <Description>Code snippet for methods</Description>
          <Author>Adam Anderson</Author>
          <SnippetTypes>
            <SnippetType>Expansion</SnippetType>
          </SnippetTypes>
        </Header>
        <Snippet>
          <Declarations>
            <Literal>
              <ID>method-modifiers</ID>
              <ToolTip>Method modifiers</ToolTip>
              <Default>public</Default>
            </Literal>
            <Literal>
              <ID>return-type</ID>
              <ToolTip>Return type</ToolTip>
              <Default>void</Default>
            </Literal>
            <Literal>
              <ID>member-name</ID>
              <ToolTip>Method name</ToolTip>
              <Default>Name</Default>
            </Literal>
            <Literal>
              <ID>param-list</ID>
              <ToolTip>Parameter list</ToolTip>
              </Default>
            </Literal>
          </Declarations>
          <Code Language="csharp">
            <![CDATA[$method-modifiers$ $return-type$ $member-name$( $param-list$ )
    {
    $end$
    }]]>
          </Code>
        </Snippet>
      </CodeSnippet>
    </CodeSnippets>

    posted on May 23, 2007  #    by Adam Anderson  Comments [0]
     Tuesday, May 15, 2007

    There's a fascinating little article "Create Advanced Web Applications With Object-Oriented Techniques" by Ray Djajadinata that delves into how JavaScript implements objects, inheritance, anonymous methods, and even a bit about simulating private properties and namespaces.  This may be relevant if you want greater depth in AJAX, particularly the Microsoft flavor ASP.NET AJAX.  There's a sidebar (by Bertrand Le Roy) about the ASP.NET AJAX OOPS implementation and use of JavaScript to add reflection and other .NET familar constructs including properties, events, enumerations and interfaces.

    posted on May 15, 2007  #    by Noel Rice  Comments [0]
     Monday, May 14, 2007

    This is one of those little things I'm looking forward to getting out of C# 3.0: inferred types. I've always throught to myself, "I just declared the variable to be that type, can't you figure it out without me spelling it out for you, C# compiler?" Well, the compiler can't figure it out yet, but here's a little snippet I cooked up so at least I don't have to type the type name twice:

    <?xml version="1.0" encoding="utf-8" ?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
      <CodeSnippet Format="1.0.0">
        <Header>
          <Title>var</Title>
          <Shortcut>var</Shortcut>
          <Description>Code snippet for declaring and initializing a variable with a type cast</Description>
          <Author>Adam Anderson</Author>
          <SnippetTypes>
            <SnippetType>Expansion</SnippetType>
          </SnippetTypes>
        </Header>
        <Snippet>
          <Declarations>
            <Literal>
              <ID>type</ID>
              <ToolTip>Variable type</ToolTip>
              <Default>Type</Default>
            </Literal>
            <Literal>
              <ID>name</ID>
              <ToolTip>Variable name</ToolTip>
              <Default>Name</Default>
            </Literal>
            <Object>
              <ID>value</ID>
              <ToolTip>Initial value</ToolTip>
              <Default>Value</Default>
              <Type>System.Object</Type>
            </Object>
          </Declarations>
          <Code Language="csharp">
            <![CDATA[$type$ $name$ = ($type$) $value$;
            $end$]]>
          </Code>
        </Snippet>
      </CodeSnippet>
    </CodeSnippets>

    To install, copy and paste the above XML into a file and save it with a .snippet extension to your code snippets directory (My Documents\Visual Studio 2005\Code Snippets\Visual C#\My Code Snippets). To use, simply type "var" and press Tab.

    Now as you type the type name, it will be duplicated for you in the type cast.

    Every little annoyance eliminated is productivity gained. Enjoy!

    posted on May 14, 2007  #    by Adam Anderson  Comments [0]
     Tuesday, April 17, 2007

    You might overlook the JavaScript debugging utility that's already built in to Visual Studio 2005: the Script Explorer window.  The Script Explorer can take care of the usual debugging tasks like stepping through code, adding watches and evaluating variables. 

    To use the debugger in Internet Explorer navigate to the browser Tools | Internet Options | Advanced tab and make sure that "Disable script debugging" is turned off. 

    Run your web application in Visual Studio 2005.  Then select the menu option for Debug | Windows | Script Explorer.  Notice in the background the tags for telerik RadEditor controls...

    The first thing you notice in the Script Explorer window is a series of JavaScript and resource files that are currently loaded.  Double click on the aspx file you're currently working with and you will see the evaluated HTML returned from the server.  The RadEditor control now shows as its computed HTML, CSS and JavaScript that will actually be functioning in the browser. 

    You can also navigate up to the script for the page and set breakpoints and watches.  When the JavaScript executes and hits your breakpoint you get all the usual Visual Studio debugging capabilities for free.

    Next blog I'll show the excellent "Firebug" debugging utility for Firefox.  Firebug doesn't stop at just JavaScript but works with the entire stack of AJAX related technologies (and has a high cool-factor).

     |  |