Wednesday, June 14, 2017

Location of Microsoft.WindowsAzure.ServiceRuntime

Today while building a new Azure Worker I needed to add a reference to the Microsoft.WindowsAzure.ServiceRuntime, but couldn't find it right away.

I first went to the usual place where you find other Azure references: nuget. But, nope it wasn't there.

I did some poking around and eventually found it in the Add References dialog under Assemblies - Extensions. Hopefully this helps someone else as well.


Thursday, June 8, 2017

How to get iOS 11 and start playing with the new AR features

Apple announced the next version of iOS this past week at WWDC, and one of the features that I'm looking forward to is the Augmented Reality (AR) features that are built in. I can't wait, so I'm going to install the beta of iOS 11 this week on an 'old' iPhone 6S Plus that I have as a test driver device. Here are the steps to get the beta if, like me, you can't wait either.

I'm assuming that you already have a developer account with Apple and can follow these instructions. If you're not in the Apple developer program, you can sign up for the public beta () but it won't be available until later this month (June 2017).

Backup 

If you ever want to go back to iOS 10, you'll need to create an archive backup via iTunes or iCloud. I'm using a test device, so I won't be performing a backup.

Download 

On your phone or tablet, visit: developer.apple.com. Sign in with your Apple developer account. Go to the Downloads link:


Find the iOS 11 beta in the list of downloads.

Tap the Download button for the iOS 11 beta, to download the Configuration Profile on your device.

Consent 

You'll be taken to the beta profile. Touch the link to Install. Again, read the message from Apple that you are using beta software, then Touch Install.


Restart Your device will restart and you'll be on your way to getting the latest beta bits. Because I am interested in Hololens and AR in general, I'll be playing with the Augmented Reality (AR) features in the iOS 11 beta over the next few months. I will put up some blog posts about what I find and what I'm building.

My posts will be specific to iOS 11 AR features used in Xamarin iOS and Xamarin Forms.

Thursday, September 8, 2016

The dreaded 'error MSB6006: "tsc.exe" exited with code 1.' message when building

TypeScript is an amazing tool when working with JavaScript in MVC projects. If you haven't checked it out yet you really should. It makes working with JavaScript so much better and easier. Pluralsight has a terrific course on it here.

This blog post isn't about TypeScript and all its greatness. But rather, it is about quickly debugging build errors when building your web project in Visual Studio and you get the dreaded "tsc.exe exited with code 1".

Just like any build error, the built in tools are usually your best bet for debugging the issue. Whether it is a command in your project's pre-build or post-build events; or a tool like TypeScript failing as part of the build. Usually when calling an external tool from Visual Studio, I have always seen the error reported as "error code 1" or something similar. As an example, try to run the gacutil command from a post-build event when you do NOT run Visual Studio as an admin to see a quick example of this.

Anyway, back to the issue at hand. Today, I pulled down the latest code from MASTER and merged into my branch, build the solution and (insert sad horn sound here) I get the following lone build error:

'tsc.exe' exited with code 1.

To get better insight into the build error, I turn to the tools already at my disposal in Visual Studio. This is a build error, so what better tool to use than MSBUILD? First step, let's change the build logging level so that we can see exactly what is going on and what _exact_ command is being run with tsc.exe.

Go into Visual Studio, Tools - Options, Projects and Solutions - Build and Run, then change the MSBuild project build output verbosity to Diagnostic, click Ok.
Build and Run Settings

Rebuild the solution and then we head to the Output window. Use CTRL-F to bring up the Find window in the Build Output window, and enter tsc.exe. Make sure that you limit the search to the current window. Click the find icon.

This will take you to the first instance of the tsc command:
If you scroll down from here you'll see that this is setting up all of your options for the TypeScript command. The key parameters to note are:
  • FullPathsToFiles - this parameter contains all of the TypeScript (*.ts) files that will be used to generate your JavaScript files.


  • ToolsVersion- the version of TypeScript to use. I'm currently using version 1.8. The default location for installing TypeScript is:  C:\Program Files (x86)\Microsoft SDKs\TypeScript, and then the sub-folder will be which ever version(s) of TypeScript you have installed on your development environment. I have two sub-folders: 1.7 and 1.8,


Click on the find icon again, and you will be taken to the actual TypeScript command that Visual Studio is running to generate your JavaScript files. The command that is run for my particular build is:

 C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe  --module AMD --sourcemap --target ES5 --noEmitOnError --locale en-US "[All files that were in my FullPathsToFiles]"

I removed the entire block of files from the command just to shorten things up a bit for illustration. I don't want my entire blogpost to be the 40 or so TypeScript files from my build command.  :)

Now that we know what command Visual Studio is trying to run for us, we can run it ourselves in a command window and identify the specific build error, and fix it. I run the Developer Command Prompt for VS 2015 as an Administrator. Copy and paste the full tsc.exe command from my Visual Studio 2015 Output Window, to the command prompt and run it.

NOTE: I had to add double quotes around the first part of the command: "C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe" because of the spaces in the command path. YMMV.

I run the tsc.exe command and my build error becomes crystal clear:  in my latest merge from MASTER a file was deleted from the repo, but was still referenced in my web project:

"Cannot open file 'C:\{My Path}\{ProjectName}.Web\Scripts\typings\moment\moment-node.d.ts'.
error TS6053: File 'C:/{My Path}\{ProjectName}.Web/Scripts/typings/moment/moment-node.d.ts' not found."

I go to the folder path in my web project, and the .TS file is not there.



A quick phone call to my team and the TS file is added back into the MASTER repo, I merge that into my branch and the build compiles.

So, that's how to resolve the very specific tsc.exe build error. But, I hope this also helps you to debug any build error that is not very detailed (SomeTool exited with error code 1) when Visual Studio runs an "external" tool for you as part of the build process.

See ya around.

Tim

PS: Be sure to change your MSBuild logging level back to minimal. :)

Tuesday, May 17, 2016

SSMS 'Connect to Server' dialog is MIA on multiple monitors

I have been experiencing very frustrating behavior with Sql Server Management Studio (version 11.0.602) when working with multiple monitors.  When I open SSMS, the 'connect to server' dialog does not appear on any of my three monitors.  It seems to appear off the screen somewhere and I cannot get to it.  It's been quite a pain lately.

Granted, my development environment is not 'typical'.  I am running a Windows 10 VM in parallels on a MacBookPro with two external Apple monitors and using the monitor on the MBP as well.

For a while I would just disconnect my external monitors in order to get SSMS to show the 'connect to server' dialog, but I wanted to find a better way; and I wanted to share the solution with anyone else that is experiencing this same issue.

Here are the steps:

  1. Launch Sql Server Management Studio
  2. ALT-TAB to get to the SSMS Window
  3. Press the ESC key to cancel the 'connect to server' dialog
  4. Maximize the SSMS window.
  5. Click Connect, then select Database Engine
Now the 'connect to server' dialog will appear on your external monitors.  It doesn't show up on the SSMS window, but at least it shows up on one of my external monitors.  It doesn't consistently appear on the same external monitor, but hey, at least it appears now.

I hope that helps anyone else that has been experiencing this frustrating behavior.

Thursday, February 19, 2015

Xamarin.Forms - "InitializeComponent() was not found" error in a XAML page

I recently ran into an issue in Xamarin.Forms where previously working XAML (within a Content Page XAML) just stopped working and the following error was raised in Xamarin Studio:

InitializationComponent() was not found

I did some research and found that the myProject.projItems (*) file in the Xamarin.Forms project was changed and the XAML Content Pages nodes were no longer setup correctly.  Somehow Xamarin Studio changed the file and the XAML page nodes were now:

<Page Include="$(MSBuildThisFileDirectory)Views\Controls\MyContentPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
</Page>

When I changed the nodes to match the following, the InitializeComponent() error went away.:

<EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\Controls\MyContentPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
 </EmbeddedResource>

I then went through the file and changed the other XAML files, and restarted Xamarin Studio and the error went away.

(*) NOTE - My Xamarin.Forms project wasn't named "myProject", it is set to that name to simplify the illustration. :) 

Monday, January 19, 2015

Windows Phone 8.1 Lumia 1520 Group Messaging issue

Recently I had an issue with a Lumia 1520, running Windows Phone 8.1, where my text messages sent to a group text were immediately sent back to me, in addition to the group.  My phone number would be added to the group text and I received each and every text that I sent, as well as those from the members of the group text.  It was more than annoying. 

After doing some research, I found out how to stop this from occurring; the steps are below.  I've already had to apply this "fix" at least three times over the past three months, so I know it works, but I'm just not sure why it happens in the first place.

Here are the steps to correct the issue:

  1. On your phone, go into Settings
  2. Swipe right to the "applications" tab, and select "messaging"
  3. Turn off Group Text by unselecting the option
  4. Restart your Lumia 1520 by holding the lock button - camera button - and volume down button at the same time until your phone vibrates and restarts.
  5. Once your phone restarts, go back into Settings and turn Group Text back on.
  6. I then delete any group text threads where my phone number appears as a recipient.

Again, not sure why this happens, but it started happening in October 2014 and has occurred about four times since the time of writing this post.  I am part of the Developer Preview program so it may have something to do with that, but hopefully it is fixed before the next official OS release / update.

I'm running Windows Phone - 8.10.14219.341, with Lumia Cyan.  Anyway, hope this helps someone else.