Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives

October 2007 - Posts

.Net Zip library

The MSDN blogs are a really great source for all sorts of information. I browse the main blog page regularly, just to get a feeling of what is happening on the Microsoft side of things. This morning I found a link to a Codeplex project which encapsulates the System.IO.Compression.DeflateStream class to allow you to read and write zip files.

The project can be found here: http://www.codeplex.com/DotNetZip.

Sandcastle October 2007 CTP released

Only a few weeks after the September release of Sandcastle, Microsoft have already released the October CTP. Again, a number of bugs have been fixed and some new features are added. Most noticeable feature is the support for FireFox. The HTML that is rendered by this release of Sandcastle should drastically improve compatibility with FireFox. So all Internet Explorer haters can now enjoy Sandcastle as well.

A full list of bug fixes, new features and changes can be found here. The CTP itself can be downloaded here.

If you want to try Sandcastle then I suggest you read this blog post to see which items should be installed.

What is that treeview doing? Who can help? Problem SOLVED!

We're currently migrating our web applications from the .Net 1.1 framework to .Net 2.0. The whole process runs quite smoothly, untill yesterday that is.

In a few web forms, we've previously used the TreeView which was in the Microsoft Web Components library and it worked fine. But that was 1.1 code and in 2.0 we have a new version of the TreeView control. So we needed to make some changes. That all worked out just fine, but when we run our application we get very strange behaviour from the TreeView component.

When the application starts, a user would see this:

But when the user then clicks on the Minus sign to collapse the tree, the tree moves down a bit. And if you then click the Plus sign to expand the tree node, it stays in position. The TreeView then looks like this:

I save the source for both versions of the HTML and compared it. Both source files are identical! So what's going wrong? Who can help me?

Update

We found the problem. We removed the following from our page: smartNavigation="true"

Posted: Oct 23 2007, 09:42 AM by Jan Schreuder | with 3 comment(s)
Filed under:
What FxCop rules do Microsoft have turned on internally?

Ever wondered if Microsoft use FxCop themselves, and which rules they have turned on? Well, the Visual Studio Code Analysis Team Blog gives you the answer. If you click this link, you will find a complete list of rules Microsoft use when analysing their code with FxCop.

FxCop 1.36 Beta available for download

The Visual Studio Code Analysis Team Blog announces the release of FxCop 1.36 Beta.This new version contains the following (taken from the original post):

  • 200+ bug fixes that reduce noise, missing analysis and rule crashes
  • Support for analyzing anonymous methods and lambda expressions
  • New option for skipping analysis over tool generated code
  • Better support for C++/CLI and the Compact Framework
  • Language 'friendly' API names in the UI and resolutions (ie Visual Basic syntax if running over a Visual Basic binary)
  • New globalization, design and usage rules
  • Performance improvements that cut analysis by 2x and use half as much memory
  • Documentation that is now available on MSDN
  • You can download it here!

    Another "What the F**K" moment

    I tried compiling my application just now and got this error message from the compiler:

    Preparing resources...
    Updating references...
    Performing main compilation...
    error CS0583: Internal Compiler Error (0xc0000005 at address 77FCD43E): likely culprit is 'PARSE'.
     
    An internal error has occurred in the compiler. To work around this problem, try simplifying or 
    changing the program near the locations listed below. Locations at the top of the list are closer 
    to the point at which the internal error occurred.
     
    c:\inetpub\wwwroot\Intra\Hierarchy.aspx.cs: error CS0586: Internal Compiler Error: stage 'PARSE'
    error CS0587: Internal Compiler Error: stage 'PARSE'
    error CS0587: Internal Compiler Error: stage 'BEGIN'
     

    Excuse me?!?!?! The last time I ever received errors like this was in 1996, while building applications for good-old MS-Dos. The Microsoft C compiler in some cases could not parse the code and presented you with a "Too complex" error. The only way around this was to re-order the code. But in the .Net age I never came across this error. Until now that is.

    And what's even stranger is that a rebuild of the app solved the problem. I'm lost. Any one out there has any experience with this error?

    Sandcastle September 2007 CTP released

    I think it was announced almost three weeks ago, but it is finally released today. There are obviously a number of bug fixes, as well as some new features in this release. A full list of bug fixes, new features and changes can be found here. If you want to use Sandcastle, I suggest you download and install the following items.

    1. Visual Studio 2005 SDK Version 4.0. Make sure you install this first. It contains an old version of Sandcastle which will be replaced by the new CTP. It also contains the 2.0 help compiler.
    2. Sandcastle - September 2007 Community Technology Preview (CTP). This is the actual Sandcastle CTP. After installation, make sure that you run the following command to generate reflection files for the .Net 2.0 framework: msbuild fxReflection.proj /Property:NetfxVer=2.0 /Property:PresentationStyle=%1
    3. Download DocProject.or Sandcastle Help File Builder to make building help files a lot simpler. Be aware though, that these applications are open-source projects and may need to be changed before they fully support the new Sandcastle CTP. From experience, I know that it will normally take less than a week for these applications to be fully compatible with the latest CTP.
    What the F**K is the 'Grady' operator

    The web application I'm working on logs errors in a log file using Log4Net. Nothing new, loads of applications do that. But I was surprised when I found the following error message:

    System.Data.SyntaxErrorException: Syntax error: Missing operand after 'grady' operator.

    Now what in heavens name is a 'Grady' operator. I had no clue. Google only knows Grady from the book "Object-Oriented Analysis And Design With Applications" and other OO related work. So no solution to be found there. So what could it be?

    I looked into the log file again and checked if the exception was raised more than once. I found more interesting 'operators': 'Toole', 'Amore','Sullivan'. Wait a minute there all names. I checked the stack traces for these exceptions and then it dawned on me. The error was raised when the user clicked a filter button. The web page where the error was raised showed a user list. Apparently, the user was looking for someone named O'Toole or O'Sullivan. I checked the code and found this:

    if (txtUserFilter.Text != String.Empty)
    {
        dataTable.DefaultView.RowFilter = string.Format("NAME like '%{0}%'", txtUserFilter.Text);
    }

    This will work fine of course, provided the text string does not contain any single quotes. The following solved my problem:

    if(txtUserFilter.Text != String.Empty)
    {
        dataTable.DefaultView.RowFilter = string.Format("NAME like '%{0}%'", txtUserFilter.Text.Replace("'", "''"));
    }