.Net Programming

April 01, 2013

Enabling Remote Debugging for Windows 8 Apps

Very short post but I hope this will save somebody lot of time. I was trying to debug a Windows 8 Store App on my Surface RT however quite a few of my attempts failed. The issue was obviously networking related because all the tools were properly installed, configured and started.

The whole problem was that my workstation running Visual Studio 2012 was not able to see the Surface RT machine and attach to the process. After some poking around I figured out that ping is not working to the Surface although during the configuration of the Remote Debugger I explicitly set the options to allow debugging on any network. Once ping was enabled everything worked out. You can enable ping by issueing the following command from an elevated Command Prompt:

netsh firewall set icmpsetting 8

Also, don't forget to install the Remote Tools for Visual Studio 2012 (ARM) from http://go.microsoft.com/?linkid=9810474

November 06, 2012

Windows Phone 8 Development on Mac - All the Gotchas

After failing with my attempts to kickstart my Windows 8 development I decided to give Windows Phone 8 a try. Creating Windows 8 Developer account was straight forward compared to the Windows 8 experience however setting up the development environment on my Mac turned out to be painful. I will save you all the steps, which involved reinstalling Mountain Lion, setting up Bootcamp partition, installing Parallels etc. and resulted in few dosens screenshots with errors and exceptions in Visual Studio. Let's get straight to the point.

Is your machine ready for Windows Phone 8 development?

First of all, if you want to do Windows Phone 8 development (the same is true for Windows 8 development), you need a Windows 8 machine. In all fairness this is no different than iOS development... however there are the gotchas below :)

One of the most important things that you need when you do device development is the Emulator. If you don't want to spend all your money buying every possible Windows Phone the Emulator will be your solution for testing. Now, the problem with Windows 8 Phone development is that the Emulator uses the Hypervisor build into Windows 8. However in order to run Windows 8 Hypervisor your development machine (actually the CPU in your machine) needs to support SLAT. If you need more details you can go check Wikipedia's article about SLAT but briefly it is a new virtualization technology available in the modern CPUs.

Here are the official requirements for Windows Phone 8 SDK posted by Microsoft.

If you are like me and you bought your Mac awhile ago it may not be equipped with a "modern" CPU. Here are the steps you can use to check whether you will be able to run Windows Phone 8 Emulator on your Mac:

  1. Install Windows on your Mac
    If you have Windows already running on it it is fine. Doesn't need to be Windows 8, Windows 7 will work just fine. You can use Parallels or Bootcamp or whatever else you want. The sole purpose of this step is to have a way to run the program from Step #2.
  2. Download Coreinfo
    Coreinfo is a small program written by Mark Russinovich that checks low level hardware components.
  3. Run Coreinfo and check the output
    Here is the interesting part. If you have older Intel based Mac (or Macbook Pro like me) your machine may be equipped with Core 2 Duo processor that doesn't support SLAT. General rule is that Intel i-processors support SLAT while everything before that doesn't. Wikipedia has a good list of all Mac models and their CPUs.

For me here is how the output from Coreinfo looked:

CoreInfo

I have Core2 Duo P8600 and although it supports hardware virtualization I wasn't able to run Windows Phone 8 Emulator (as well as the Hyper-V in Windows 8). Interesting though Windows 8 Simulator runs fine although I thought is is based on the Hyper-V too. The best I managed to achieve was the following:

Win8Phone Designer Issue

Interestingly before upgrading from Lion to Mountain Lion I was able to at least see the designer working. Now this is gone though.

Should you use Parallels or Bootcamp?

If your Mac passed the CPU test the answer on this question is quite simple - you must use Bootcamp (or at least for now).The reason is that Microsoft Hyper-V doesn't run in virtualized environment hence your only option is to have Windows 8 installed on a separate partition using Bootcamp.

My personal opinion is that the approach Microsoft took (again) will prevent some of the potential developers to start development for Windows Phone 8 (and Windows 8) as you can see from the following articles and blog posts:
Developers praise Windows Phone 8 SDK, but virtualization and upgrades rankle
Windows Phone 8 SDK what a Big Time Flop
http://forum.parallels.com/printthread.php?t=264863
Windows Phone 8 Emulator on MacBook Pro – No SLAT

There are two articles that I found explaining how you can use VMWare Fusion to run Windows 8 on your Mac. I doubt it will be successful if your machine doesn't have SLAT support but maybe it is worth looking into them:

http://blog.brightpointuk.co.uk/running-windows-phone-8-emulator-mac-os
http://www.developer.nokia.com/Community/Discussion/showthread.php?238276-Windows-Phone-8-development-on-Mac-and-VMWare-also-using-the-Phone-Emulator

Good luck with your Windows (Phone) 8 development :)

October 30, 2009

Enabling WCF HTTP Activation After Uninstalling Microsoft .Net Framework 4.0 Beta

While trying to install Windows Azure SDK I was stuck for quite a while with the following problem.

One of the prerequisites for Windows Azure SDK is to enable WCF HTTP Activation but trying to do that was always giving me the error: “An error occurred. Not all of the features were successfully changed.” Here are the steps I followed:

  1. On a Windows 7 machine click on Start button and search for “Turn Windows features on or off”; click on it once found
  2. Expand the tree under Microsoft .Net Framework 3.5.1
  3. Select Windows Communication Foundation HTTP Activation and click OK

The result of this workflow was the above mentioned error.

 

Investigation

The error above is very generic and you may receive it for any other Windows feature you turn on or off. In order to make sure the error comes specifically from enabling WCF you can do two things:

  • Turn on only the WCF option (leaving all other options in the tree as is)
  • Look at the CBS.log file available in:

    %SystemRoot%\Logs\CBS

    And search for errors caused by SMConfigInstaller.

 

The Problem

You will encounter this problem if you install .Net Framework 4.0 Beta 1 and uninstall it after that. I am not sure whether the issue is reproducible in the latest Beta delivered with Visual Studio 2010. The reason is that the uninstaller doesn’t clean up properly, and you end up with version 4.0 of SMConfigInstaller.exe under

%SystemRoot%\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation

You can check the version of the file by right-clicking on it, and selecting Properties –> Details tab. The correct version should be 3.0.xxxx.

 

Solution

The issue is semi-easy to solve:) I write “semi” because 1.) it took me about 1 h to search in Web and try out different options 2.) you need to get around the Windows 7 (and Windows Vista) security model and 3.) you need to have the correct version of the file. You will be mostly concerned with 2.) and 3.)

Here are the steps you need to follow get to your end goal (all of this assumes of course you have admin rights):

  1. In Windows Explorer navigate to
    %SystemRoot%\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation
  2. Right click on SMConfigInstaller.exe and select Properties –> Security tab
  3. Click on the Advanced button and select the Owner tab
  4. You need to change the owner from TrustedInstaller to your own user or local Administrators group
    WARNING: Changing the owner for files in %SystemRoot% folder may introduce security risks for your system.
  5. Once you change the owner you return back to the Security tab and need to click on Edit button to edit permissions. Select Full Control for the new owner else you will still not be able to modify or delete the file
  6. Confirm all you changes and go back to Windows Explorer
  7. From another machine where you have Microsoft .Net Framework 3.0 or 3.5 installed copy SMConfigInstaller.exe and put it in the folder above
  8. Make sure the version of the file is 3.0.xxxx by right-clicking and selecting Properties –> Details tab
  9. Follow the steps at the beginning of the post

In order to reinstate the security of your system is recommended to revert back the owner of the file to TrustedInstaller.