BUG: ??????? BadImageFormatException ?? ???? ??? ??????? ??? ???? ????? ????? ??? ??? ?? ????? ????? ??? .NET Framework 2.0

?????? ????????? ?????? ?????????
???? ???????: 940164 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

???????

?? ????? ????? ??? .NET Framework 2.0 Microsoft ? ????? ??????? ??? ???? ????? ????? ??? ???. ??? ?????? ????? ?? ???? ??????? BadImageFormatException ?? ??? ???????. ???? ??? ??????? ??? ?? ????? ??????? ?????.

?????

???? ??? ??????? ????? ????? ????? ?? ?????? ??? ??????? (CLR 2.0) ????? ??????? ?? Microsoft Visual Studio 2005.

???? ??????

??????? ?????? ??? ??? ??????? ?? ?????? ????? ??? ?? GetClass E ????? <e>?????? ???????.

?????? ?????? ?? ???? ??? ??? ????? ??? ???.

?????? ????? ??? ?? GetClass E ????? <e>?????? ????? ?????? ????? ??????? ??? ???.

????????? ???????? ????????

public static E GetClass<E>() where E : class, new()

??? ?????????

public static E GetClass<E>() where E : new()

?????

???? Microsoft ?? ??? ??? ?? ?????? Microsoft ??????? ?? ??? "????? ???".

??????? ????

????? ?? ????????? ??? generics ?? CLR ?? ?????? ???? ???? ????? Microsoft (MSDN) ?????? ??? ?????:
http://msdn.microsoft.com/msdnmag/issues/06/00/NET/default.aspx

????? ????? ????? ???????

  1. ??? ???? ??????? ????? ??? Visual Studio 2005 ????? ????? ?????? C# ???????. ????????
    using System;
    
    public abstract class AbstractClass1<E> where E : AbstractClass1<E>, new()
    { }
    
    public class Class1 : AbstractClass1<Class1>
    { }
    
    public class Class2<E> where E : AbstractClass1<E>, new()
    {
        public E GetClass1()
        {
            return Factory.GetClass<E>();
        }
    }
    
    public class Factory
    {
        public static E GetClass<E>() where E : class, new()
        {
            return new E();
        }
    }
    
    public class Program
    {
        static void Main()
        {
            Console.WriteLine("Hit enter to continue..");
            Console.ReadLine();
            Class2<Class1> c2 = new Class2<Class1>();
            c2.GetClass1();
            Console.WriteLine("Hi");
        }
    }
    
  2. ????? ???????? ?? ?? ?????? ????????. ???? ????????? BadImageFormatException ?? ??? ??????? ??? ??????? ??????? c2.GetClass1.

???????

???? ???????: 940164 - ????? ??? ??????: 16/???/1428 - ??????: 1.0
????? ???
  • Microsoft .NET Framework 2.0
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Express Edition
????? ??????: 
kbmt kbbug kbtshoot KB940164 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????940164

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com