An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll

.Netmf 4.2
Cerbiuno Bee

The following code results in this:
An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll

Removing the reference to GHI.Premium.IO allows it to execute correctly.

I am only asking for clues. Thanks, Keith

//GHI.Premium.IO — this program works if this reference is not included.

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

namespace MFConsoleApplication1
public class Program
public static void Main()



This mainboard supports only OSHW libraries from GHI, it does not support Premium libraries. Consider upgrading to 4.3, in 4.3 most functionality from Premium libraries became available for all the mainboards.

1 Like

Can I run 4.3 libraries with 2010 Express?
Thanks, Keith

I think the answer is NO based on the NETMF download page.
Looks like I need to ditch Vista and move forward.

So one simple answer is as you say - move forward and use VS2012/2013 and netmf 4.3.

But since you’re on Vista and that may not be a simple thing for you to change, you can simply remove the reference to GHI.Premium.IO. Under 4.2, the GHI.Premium class of devices excluded the Cerberus family and Hydra devices, so you are using an invalid combination of physical device and DLLs. You’ll find the GHI OSHW equivalents are what you need for the Cerb family, and you’ll find has links to the OSHW (and Premium) API references.

If there’s something in the Premium library you can’t do in the OSHW library, there’s no way under 4.2 to get those capabilities from provided libraries. What made you add that reference in anyway ?

Thanks for the explanation.

I added the reference out of ignorance not knowing the premium libraries do not support the Cerb device I have.

I am just in learning mode at the moment. What I have been doing is finding code that does something I am interested in and figuring out how it works. In a lot of cases the code won’t work for me because of unsupported libraries or because I do not have 4.3.

At this moment there is not anything specifically that I cannot do on the Cerbuino Bee with 4.2 and non-premium libraries. I am working on SD read/write and it looks like the 4.3 libraries have improved support for SD.

I do find it difficult to determine which libraries are supported/not supported/required for both hardware and software but I will keep reading to gain understanding …

Thanks again, Keith

ok cool - you will find that the reason you’re coming up against some (I suspect most) of these issues with code changes etc is that the doco has been updated to cover 4.3 as the 4.2 code was no longer relevant. Certainly I’d suggest in the medium to short term you get to VS2013 and 4.3 so you can be aligned with what most of the content is produced for - especially while you’re trying to learn, it’s hard to know if you are doing something wrong, or just using code that isn’t intended to work with your SDK.

You should ask if you have any specific challenges, people are more than happy to try to help unravel that. The API reference for 4.2 is still correct so you should be able to sort through it as needed, but the tricks come from where you might need to convert equivalent code back to 4.2 and that’s not always straight forward unfortunately.