Problem with user led on Cerbuino

If I create a “pure NETMF” application and use this declaration :

OutputPort Led = new OutputPort((Cpu.Pin)18, true);

then I get no error and I can blink the onboard LED.

Now, if I create a “Gadgeteer project” and put the exact same line of code, then I get an exception :frowning:

Une exception de première chance de type 'System.NotSupportedException' s'est produite dans Microsoft.SPOT.IO.dll
Le thread '<Sans nom>' (0x2) s'est arrêté avec le code 0 (0x0).
Using mainboard GHI Electronics FEZCerbuinoBee version 1.2
Une exception de première chance de type 'System.Exception' s'est produite dans Microsoft.SPOT.Hardware.dll
Une exception non gérée du type 'System.Exception' s'est produite dans Microsoft.SPOT.Hardware.dll

Le programme '[74] Micro Framework application: Managé' s'est arrêté avec le code 0 (0x0).

What is really weird here is that I can add other OutputPort(s) or even InterruptPort(s) without any exception and the code is fully functionnal :

GT.Interfaces.Serial Line;
        char SerialStart, SerialEnd;
        string SerialSep;
        private string SerialString = string.Empty;
        private bool BufferingSerial = true;
        OutputPort Test = new OutputPort((Cpu.Pin)21, false);   // Pin PB5
        InterruptPort Entree = new InterruptPort((Cpu.Pin)19, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);  // Pin PB3
        GT.Timer TimerTest = new GT.Timer(500);

        void ProgramStarted()
            string MaChaineDeCaractères = MaMéthode();

            SerialStart = '#';
            SerialEnd = '$';
            SerialSep = ";"
            Debug.Print("Program Started");
            usbSerial.Configure(9600, GT.Interfaces.Serial.SerialParity.None, GT.Interfaces.Serial.SerialStopBits.One, 8);
            Line = usbSerial.SerialLine;
            Line.DataReceived += Line_DataReceived;

            TimerTest.Tick += new GT.Timer.TickEventHandler(TimerTest_Tick);
            Entree.OnInterrupt += new NativeEventHandler(Entree_OnInterrupt);

        void Entree_OnInterrupt(uint data1, uint data2, DateTime time)
            Debug.Print("Interrupt on PB3 : "+data2);

        void TimerTest_Tick(GT.Timer timer)

PB3 & PB5 are connected together with a wire in this example.
And I indeed get “Interrupt on PB3 : 0/1” alternatively. (with a functionnal USB/Serial module connected).

What could cause this strange behaviour with PB2 ? And, moreover, are other pins concerned by this behaviour ?

That is because the mainboard driver already include wrapper for the led
Something like mainboard.led(true);

What an idiot I am :frowning: I should have thought at it… as I use this in other programs…

Thank you !