NETMF declare CAN as static

put a breakpoint on the debug statement and hit F5
Breakpoint is never reached, responsible is the " static CAN MyCan;"
Is this “normal” in NETMF?


using System;
using Microsoft.SPOT;
using GHI.Premium.Hardware;

namespace MFConsoleApplication1
{
    public class Program
    {
        // static string = no problem
        static string MyString = "";

        // static CAN = code will NOT reach the Main ???
        static CAN MyCan;
 
        public static void Main()
        {
            MyString = "Hi there...";
            Debug.Print("just a breakpoint");

            // somewhare here read the parameters for the CAN port and fire it up
            //MyCan = new CAN( and the correct parameters)
        }

    }
}


I just want to CAN object availible in the complete class

What exactly is happening?

Is there a deployment problem?

What appears in the Output window?

Nothing happens, main is not executed, no errors, no warnings, nothing in the output window.

Nothing happens?

I can not see how nothing will appear in the output window. At a minimum, there has to be some deployment information.

Can you ping the device with MFDeploy?

@ andre.m -

The G120 and a std NETMF console app.
And If you put “static CAN MyCan;” in comment then it works.
The same happens if i would put a static declare for a SD card.

One more thing maybe, this wil run in emulator mode, but not on the G120

@ Mike -

Ah, i was talking about the debug window.

The output window shows the why :slight_smile:

assembly: GHI.Premium.Hardware (4.2.7.0) ***********************************************************************

  •                                                                 *
    
  • ERROR!!! Firmware version does not match managed code version!!! *
  •                                                                 *
    
  •                                                                 *
    
  • Invalid native checksum: GHI.Premium.Hardware 0x4814E574!=0xB76228F2 *
  •                                                                 *
    

This means i have to update the G120 first?

The Firmware on Hardware must match the SDK you use.
If you install a new SDK or if you get a new module use the FirmwareUpdater to update the Firmware.

Yea, still having trouble with that in another topic, guess i have to take it step by step, update the boards first en then start porting code.

Thanks for the help !