.NET MF – Alive and kicking!

26 09 2014

Very interesting news around .NET MF. After years of self-implied agony, Microsoft has discovered the unmatched potential of this very cool technology.

As Olivier Bloch states on his blog, the MS Open Tech group now has started to take care of it: http://msopentech.com/blog/2014/09/24/net-micro-framework-vs2013.

Or, see the official MF blog here: http://blogs.msdn.com/b/netmfteam/archive/2014/09/23/net-micro-framework-sdk-beta-released.aspx.

This is outstanding! :-)

.NET MF could really become a game changer for Microsoft in the expanding IoT market.
Why? Because it allows very easy access to hardware functionality baked into a SOC. Think of something like “CPU.Pin1 = true” to set a physical GPIO pin. But wait, there is more! Support for Interop to do native stuff, Web Service for Devices and embedded bus support (SPI, I2C, UART). Now fully integrated into Visual Studio 2013 and upcoming 2014 versions. At the very core, although a subset, all important .NET APIs are available and thus the sky ( or should I have said Cloud?) is the limit.

Like Arduino? No, this is much better. Arduino is a plaything for designers, working great for rapid prototyping. .NET MF is for professional developers. We start to get things done and production ready, right?

I have never stopped supporting .NET MF and used it through several successful projects. There is a great training available here: .NET Micro Framework, which I will keep on the latest version just as news are rolling in.

Btw., .NET MF nodes in a solution leveraging an event driven state machine architecture (more info on this here) are able to solve even the most demanding solution requirements.

 

Alexander





Counter Jailbreaks on Windows Phone 8.1

25 08 2014

Windows Phone8/8.1 is normally a very secure OS looking at jailbreaks, though recently some phones were hacked at least to install apps from non-original stores. If you are a company IT-admin you may ask yourself: Even if we do not use the phones jail-breaked, is there a way to prevent this?

Yes, there is and it is even relatively simple. If you are using EAS (Exchange Active Sync) or an MDM system you can either encrypt the file system of the phone or turn off USB connectivity. Please be aware, there is no manual option for this! 
Each of the measures disables the known attack angles and increases security for the phone quite a bit!

:-)

Alexander 





Windows Phone 8 / 8.1 – Encrypted or not encrypted?

13 06 2014

There is quite some confusion going on about the device encryption on Windows Phone 8.1!
Early WP 8 documents were telling that all devices are encrypted automatically, but this is unfortunately not true!
If You buy a Windows Phone 8/8.1 phone, it is not encrypted. The encryption cannot be activated on the device itself, instead it must be activated either via an Exchange Active Sync mailbox policy or an MDM system. The encryption happens automatically, when a user is connecting to Exchange Server or O365 mailbox with a policy set for encryption, or when the device is managed by an MDM system such as Intune/SCCM, MobileIron, etc.. These allow to turn on encryption, as well. 
Do not expect to get a prompt or anything like this, just the policies are applied and then device then is encrypted.
On WP 8.1 phones one can check this via the Storage Sense app. If it shows storage encrypted there, the internal phone storage has been secured.
Attention: The encryption of a device is non-reversible! This is a one way ticket.
Can all Windows 8/8.1 phones be encrypted?
Well I have not checked all of them, but at least for the Nokia Lumia family, encryption is supported throughout all devices, even on low-end devices such as the Lumia 520.

Happy ciphering! :-)

Alexander





Embedded Forum – Internet of Things (IoT)

2 05 2014

A new NIK event for the Embedded Industry focusing on the mega-trend in this sector: The Internet of Things!

I will be giving the kick-off keynote at this information-packed workshop, shedding some light at the benefits, opportunities, drawbacks as well as dangers one should be aware of, using the exciting new technology options.
Well-known experts from industry and education join me to take a deeper dive into IoT-ready communication standards, security mechanisms and share a lot of insight how to create scalable and robust connected systems.
It will be interesting, it will be fun, it will be entertaining!
Do not miss out! :-)

This is a free event and everybody interested is welcome.
Please register for the event at NIK.

Location & Time

Embedded Forum – Internet of Things (IoT)
Dienstag | 20. Mai 2014 | 13:00 – 18:00 | Presseclub Nürnberg
Gewerbemuseumsplatz 2 – 90403 Nürnberg

Important information in cooperation with our partners at the Nuremberg Initiative of Communication .





Unit Testing async MVC Controller methods

14 03 2014

Just had a strange encounter in VS 2013 unit testing. I wrote a unit test for the ASP.NET Identity AccountController, which has some asynchronous methods.
My good old friend Resharper told me to change the method signature to public async void, as I wrote the code to call my controller method using await. The code looked like this:

[TestClass] public class AccountControllerTest {     [TestMethod]
     public async void Register()
     {…
var result = await controller.Register(userModel);

}

}

 

If you run this, it builds well, but nothing happens, even debugging the test is not working. The test is invisible to the test runner!

Strange thing, which, thank good, is not happening too often in Visual Studio.

The only message I got, after fiddling around, was that there are no tests found in my class file.

Even stranger, as my test attributes proof sufficiently, I did all things required to make my test detectable to unit testing, so why is it not carried out???

Did it turn into a phantom? Black magic going on?

No, do not worry, it is not so exciting. As I had to discover, it is the async void keywords!

The background for this is reasonable, because “async void” methods are “fire and forget” ones, which may never come back and this does not really make sense in a test environment, where you need to collect results and assertions from a method. 

What is the correct way to test an aysnc method, then?

You have to use task as return type instead of void, this works well!

[TestClass] public class AccountControllerTest {     [TestMethod]
     public async Task Register()
     {…
var result = await controller.Register(userModel);

}

}

 

Alexander





MVC Web API and ASP.NET Identity – Changing Identity Database Connection

12 03 2014

Sometimes simple things are hard, or at least hard to find.
I have created a Web API and added ASP.NET Identity for user management.

This works well, if one uses the project template, not so well if you want to add ASP.NET Identity at at a later point of time. Therefore just remember it, when creating the project.
However, I did not want to use the preset standard localdb database file  in my application. I was looking where to change the identity database context.
It was obvious that the presets use the “DefaultConnection” connection string in web.config and it works, if you rename the database there, but sometimes I am a bit picky and I wanted to name this special connection differently: “IdentityConnection”.

It really took my a while, because all my searches for DBContext and IdentityDBContext were in vain.
I drilled in deeper and ended up in the Startup.Auth.cs file in the Startup folder of my solution.
Here the user store gets initialized with this line of code:

UserManagerFactory = () 
=> new UserManager<IdentityUser>(new UserStore<IdentityUser>()));

This is the place to change the identity connection string!

One needs to use a different overload of the store’s constructor passing in a new IdentityContext created with the new db connection. Such as this:

UserManagerFactory = () => new UserManager<IdentityUser>
(new UserStore<IdentityUser>(new IdentityDbContext("IdentityConnection")));

And yes, the new “IdentityConnection” connection needs to be configured in Web.Config, of course.

After this, the Identity tables get created in the new database, as specified.

This should not be so hard to find. Maybe the Web API developers have some time to put in a comment in Startup.Auth.cs about db configuration, in the next version.

 

:-)

Alexander





Building State Machines in .NET

22 02 2014

My new online course is out!
If you are creating embedded devices you, of  course, are aware of state machines. They are, or at least should be, an essential infrastructure asset to any solution.
Why?
Well, because state machines build flexibility and extensibility into a system, add structure and are able to scale from device level into backend systems. 
It is one of the most powerful architectural concepts one can use to create solutions that are most enduring and future-proof.

But wait, there is more!
The course adds an event driven communication architecture as well as a service oriented implementation approach to the state machine design, to further remove dependencies and add easy configurability.
Just check it out at my friends at Pluralsight!

Get ready for the Internet of Things and Industry 4.0.

:-)

Alexander








Follow

Get every new post delivered to your Inbox.