G30 - "Invalid address ..." error after update to SDK 2016 R1 Pre-Release 1

After I updated my computer and G30 boards (both G30 SoC and G30HDR have this problem) to the new SDK 2016 R1 Pre-Release 1 version, I am getting the following error message in Visual Studio 2013 debug output. This only happens when I place a breakpoint and step through the code in the debugger. All the program does is print “Hello World!” (see code below the output).

The program appears to execute correctly in this case, however for a more complicated program that I am working on strange things are happening. As I step through in the debugger, a line of code that is declaring a bool variable and setting it to true throws a NullReferenceException, and then debugger then jumps to highlighting some completely unrelated line of code in yellow, as if that’s where I was in stepping through the code.

Does this make sense to anyone?

Debug Output

.
.
.
Microsoft.SPOT.Debugger.CorDebug.12.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Graphics.dll', Symbols loaded.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
 Invalid address 0 and range 384 Ram Start 20000000, Ram end 20018000
 Invalid address 0 and range 384 Ram Start 20000000, Ram end 20018000
 Invalid address 0 and range 384 Ram Start 20000000, Ram end 20018000
 Invalid address fffffdf6 and range 48 Ram Start 20000000, Ram end 20018000
 Invalid address 384 and range 90 Ram Start 20000000, Ram end 20018000
 Invalid address 414 and range cb Ram Start 20000000, Ram end 20018000
Hello World!
 Invalid address 0 and range 400 Ram Start 20000000, Ram end 20018000
 Invalid address 400 and range df Ram Start 20000000, Ram end 20018000
 Invalid address 0 and range 400 Ram Start 20000000, Ram end 20018000
 Invalid address 400 and range df Ram Start 20000000, Ram end 20018000
 Invalid address 0 and range 400 Ram Start 20000000, Ram end 20018000
 Invalid address 400 and range df Ram Start 20000000, Ram end 20018000
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
Done.

Code

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.Threading;

namespace MFConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print("Hello World!");
        }
    }
}

just to confirm - this is a brand new project in VS, that doesn’t have any legacy references?

Might be worth including a little more of the deployment info as well, to see versioning of the deployed assemblies.

@ Brett - Yes, if I make a new Micro Framework “Console Application” project in Visual Studio 2013, here is the code and output. All I did is change the deployment from the emulator to the USB G30_G30 device.

Code

using System;
using Microsoft.SPOT;

namespace MFConsoleApplication2
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print(Resources.GetString(Resources.StringResources.String1));
        }
    }
}

Build

1>------ Build started: Project: MFConsoleApplication2, Configuration: Debug Any CPU ------
1>  MFConsoleApplication2 -> c:\users\xxxxxxxxxx\Documents\Development\MFConsoleApplication2\MFConsoleApplication2\bin\Debug\MFConsoleApplication2.exe
2>------ Deploy started: Project: MFConsoleApplication2, Configuration: Debug Any CPU ------
2>------ Deploy started: Project: MFConsoleApplication2, Configuration: Debug Any CPU ------
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

Micro Framework Device Deployment

Looking for a device on transport 'USB'
Starting device deployment...
Iteration 0
Opening port \\?\usb#vid_1b9f&pid_0102#8&24012b4&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Attaching debugger engine...
... debugger engine attached!
Querying device assemblies...
Found Assembly mscorlib 4.3.1.0
Found Assembly Microsoft.SPOT.Native 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware.SerialPort 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware.PWM 4.3.1.0
Found Assembly Microsoft.SPOT.Graphics 4.3.1.0
Found Assembly xxxxxxxxxx Microcontroller 1.0.0.0
Found Assembly GHI.Pins 4.3.8.0
Found Assembly GHI.Hardware 4.3.8.0
Adding pe file c:\users\xxxxxxxxxx\Documents\Development\MFConsoleApplication2\MFConsoleApplication2\bin\Debug\le\MFConsoleApplication2.pe to deployment bundle
Attempting deployment...
Incrementally deploying assemblies to device
Deploying assemblies for a total size of 752 bytes
Assemblies successfully deployed to device.
Restarting interpreter...
Attaching to device...
Waiting for device to initialize...

Debug

Found debugger!

Create TS.

 Loading start at 804e684, end 805f5a0

   Assembly: mscorlib (4.3.1.0)     Assembly: Microsoft.SPOT.Native (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware (4.3.1.0)  
   Assembly: Microsoft.SPOT.Hardware.SerialPort (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware.PWM (4.3.1.0)  
Loading Deployment Assemblies.

Attaching deployed file.

   Assembly: MFConsoleApplication2 (1.0.0.0)  Resolving.

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

'Microsoft.SPOT.Debugger.CorDebug.12.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Native.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.12.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.12.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.12.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.12.dll' (Managed): Loaded 'c:\users\xxxxxxxxxx\Documents\Development\MFConsoleApplication2\MFConsoleApplication2\bin\Debug\le\MFConsoleApplication2.exe', Symbols loaded.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
 Invalid address 0 and range 384 Ram Start 20000000, Ram end 20018000
 Invalid address 0 and range 384 Ram Start 20000000, Ram end 20018000
 Invalid address fffffdf6 and range 48 Ram Start 20000000, Ram end 20018000
 Invalid address 384 and range 90 Ram Start 20000000, Ram end 20018000
 Invalid address 414 and range cb Ram Start 20000000, Ram end 20018000
Hello World!
The program '[1] Micro Framework application: Managed' has exited with code 0 (0x0).

What’s:

Found Assembly xxxxxxxxxx Microcontroller 1.0.0.0 ?

@ Justin - It is an assembly that is on the G30 board for another project that I am doing, unrelated to the new “MFConsoleApplication2” project. Isn’t that what it means when it says “Querying device assemblies…” and then lists what was found?

Was that there before the upgrade?
Yes you are correct, but I would erase and start afresh…

I have confirmed that after uninstalling the latest SDK, installing “GHI Electronics NETMF SDK 2015 R1”, and making a new “MFConsoleApplication3” application, I do not get the invalid memory address stuff.

Now to see if my real application still works correctly with the old SDK…

As @ Brett mentioned at the top, when upgrading you should erase the device so it doesn’t hold old outdated legacy code.

@ Justin - After upgrading to the 2016 SDK, wouldn’t the “xxxxxxxxxx Microcontroller 1.0.0.0” assembly have been redeployed to the G30, as I was actively developing it? Everything was the same version at that point. When that project was having weird problems, I created the “MFConsoleApplication” project as a simple test, and apparently that first assembly was still on the device. You don’t have to manually erase the device any time you deploy a new project do you?

You should erase the device as a test; usually there is no need to erase this and a redeploy should work.

Do you have references in your dummy app to your other project? Please take a screen shot of the references area.

References are critical when you’ve done SDK updates. You must either start a new project and copy over the old code or rip out every reference in your project (they pointed to the old SDK’s DLLs) and then re-add them (that then points to the new SDK). With your other project being loaded, that code is not compiled for the latest SDK, so you need to get it and any app that references it compiled correctly with the same SDK

@ Brett - Ok. I’m in the process of uninstalling everything (GHI SDK, Gadgeteer, .NET MF SDK), erasing the G30, and reinstalling everything.

I know what that is but you shouldn’t see it. I do not recall anyone else reporting this. Maybe you have a corrupted firmware file.

@ Gus - I did a clean install of almost everything and I still get the “Invalid address…” messages. The only thing that I did not uninstall and then reinstall (in the order given on your website) is Visual Studio 2013 Community and Windows 10.

My code seems to run, but it has problems and I don’t know if they are mine or if this is screwing something up.

So you cannot reproduce it?

Just another piece of information that may or may not help - I do NOT get the “Invalid adress…” errors in the Debug output window in Visual Studio 2015 with the same code and G30 boards.

@ DarrenUtd - We cannot reproduce the issue. Does the issue happen on only one G30 board or all that you have?