Category Archives: 7806

C# compiler and implicit keyword: can be better

Imagine the following code: class A {     public static implicit operator B(A a)     {         return new B(a);     } } class B {     public B(A a)     {     } } This code compile without … Continue reading

Posted in 7671, 7672, 7806 | Leave a comment

Bug with IQueryable and yield syntax: System.BadImageFormatException "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

I find a bug if you mix IQueryable and yield syntax. After Diego has changed a little bit my sample to reproduce it, this is the code he sent to the C# team: class Program {     static void Main(string[] args) … Continue reading

Posted in 7671, 7672, 7674, 7676, 7677, 7806 | 6 Comments

TPT with designer can generate errors 3034 or 3021

I found two cases of errors generated by the EDM designer when you want to do TPT. Error 3034: Imagine the following scenario: A table Contacts ContactID (PK) A table Employees ContactID (PK) OfficeID (Nullable, FK to Offices.OfficeID) A table Offices … Continue reading

Posted in 7671, 7674, 7675, 7806 | 2 Comments

Reflector IL to C# Bug

I was watching Entity Framework code when I found this code: switch (this.<>1__state){    case 3:    case 4:        break;    default:        return;        try        {        }        finally        {            this.<A title="void System.Data.EntityModel.SchemaObjectModel.EntityContainerAssociationSet+d__0.m__Finally6();” href=”http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data.Entity:3.5.0.0:b77a5c561934e089/System.Data.EntityModel.SchemaObjectModel.EntityContainerAssociationSet.d__0/m__Finally6()”><>m__Finally6();        }        break;} Very strange. It was the same with VB.Net. So I … Continue reading

Posted in 7671, 7672, 7673, 7678, 7806 | Leave a comment

Reflector Bug with generics

For this code: class A<T> {     public A()     {         var b = new B();     }     class B : A<T>     {     } } Reflector generates this: class A<T> {     public A()     { … Continue reading

Posted in 7671, 7806 | 2 Comments