GC.SuppressFinalize 2005 vs 2008

written by Jamie Song on Wednesday, October 15 2008

We are tracking an interesting issue with the obfuscation generating a namespace called GC.  Now this is not an issue in VS 2008 because of a change made in the compiler.  But it happens in VS 2005.  Interesting to say the least.

GC must be qualified now

Let's say you have some code that looks like this in VS 2005.

 

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Text;
   4:  using VistaDB;
   5:   
   6:  namespace TESTGC
   7:  {
   8:      class Program
   9:      {
  10:          static object obj = new object();
  11:          static void Main(string[] args)
  12:          {
  13:              GC.SuppressFinalize(obj);
  14:          }
  15:      }
  16:  }

This code will not compile on Visual Studio 2008.

You must fully qualify the GC in Visual Studio 2008 like this:  System.GC.SuppressFinalize(obj).

Recommend you update your syntax

So if you ran into this issue on Visual Studio 2005 we recommend you update your syntax to use the full name because some day you will probably want to recompile this on VS 2008.

We will be issuing a new build with a change in the obfuscator settings to prevent this naming conflict though. 

 

Similar Posts

  1. LINQ test for custom IEnumerator
  2. Dogfooding, Entity Framework and LINQ
  3. Using Generic ADO.net Data Factories

Comments

  • Eric on on 10.16.2008 at 10:05 AM

    Eric avatar

    Jamie,

    Are their any good reasons (other than not having to type any more characters than possible) not to use the full name anyway?

    Eric

  • Jamie Song on on 10.16.2008 at 4:21 PM

    Jamie Song avatar

    It was never required before - I think that is what it comes down to.

    If you had a using on System you didn't need to use the full name. Now you have to, I think to prevent namespace ambiguities just like what happened here.

  • Karl Kemp on on 10.20.2008 at 1:34 PM

    Karl Kemp avatar

    does this apply to connectors we compile to interface vistadb with tools like EntitySpaces and MyGeneration

    if so what would the syntax be for a Class Library like EntitySpaces.MetadataEngine.VistaDB

Comments are closed

Options:

Size

Colors