MikeScott8 Programming Thoughts

My musings, ponderings, and other posts on programming. And maybe gadgets and other nerd stuff.

Leave a comment

Xamarin.Forms and Azure issue

So we recently added in some Nuget packages to our Xamarin Forms solution for a project I am on at my work. When you create a “Mobile App” on Microsoft Azure under the QuickStart section they provide Xamarin.Forms instructions and even a sample solution you can download. Since we already had a solution started we followed the other option “Connect an existing app”, well mostly, but more on that in a second.

The code was put into the solution and Nuget packages added to proper projects in the solution. Then since we are using Windows computers our client provided us with, it is easier to do first dubugging and testing on Android simulator on the local PC. After all that was done and it seemed to be working then we started testing on iOS simulator, remotely, from the client provided Mac Mini we have to use for iOS building and testing.

That’s when we started having an error pop up on the application starting up.

The error message we started getting was:
“A Microsoft Azure Mobile Services assembly for the current platform was not found. Ensure that the current project references both Microsoft.WindowsAzure.Mobile and the following platform-specific assembly: Microsoft.WindowsAzure.Mobile.Ext.”

Did the usual trouble shooting and making sure we had the right Nuget packages and no extra conflicting packages. After a few dead ends we went and Googled it with Bing.

The page found in the searching for the fix for this error:

The second reply was the one that contained the line we (I, cough cough) missed. The line to initialize the mobile services wasn’t present and it is needed in iOS but the Android worked without it.

Leave a comment

Rhino Mocks Basics and Link to Wiki

I’ve been a user MOQ to mock objects for my unit testing over the years. I recently started on a project that is using Rhino Mocks (for certain layers, but that’s another topic entirely! haha).

I was able to get a bunch of simple tests done, but once I got to more advanced tests and started needing to have my “Expect” setups (and “AssertWasCalled” verification) to check what parameters were passed I ran into slight problems. I started looking online for how Rhino Mocks did it. I did a search and the first link I found (http://hibernatingrhinos.com/Oss/rhino-mocks/learn) was woefully light.

I did some more searching and found the following:


Which provided some good examples and links to other posts discussing Stub/Mock and other features. But one link was to another post by the same author about a discussion he had with a coworker about “VerifyAll” vs “AssertWasCalled” and that lead me to find the wiki for Rhino Mocks. And one section there was most of what I was looking for, how to check values on parameters to methods you setup for the test.

Rhino Mocks 3.5 wiki Constraints

I had not seen the this wiki in my search results. Wikis are not usually in my searching, so this post is mainly for me for future reference. And maybe someone will find this post someday and it will lead them to the wiki faster. At least that’s my hope.

Leave a comment

Recreating NWVDNUG site

This is the second post about the website for the user group I help run. You can go read the first post if you are interested in the attempt at manually upgrading the MVC website to the latest version of the MVC framework.

The article I referenced in the previous post said “The simplest way to upgrade is to create a new ASP.NET MVC 4 project and copy all the views, controllers, code, and content files from the existing MVC 3 project to the new project…” but then also listed steps to manually upgrade the site’s solution/project. Those steps didn’t quite match up with my situation and didn’t work, so now I am trying the “simplest way”. This is a reference of how simple this simple way is.

Steps I did to try this simple way will be listed below. There will probably be some ripping out of code as one of the updates needed for the site is to stop trying to host the meeting information on our servers and point visitors to the meetup.com page for signing up for the meeting and to see what the meeting topics are.

  • In Vs2015 did “File” “New Project…”
  • From the first dialog box that comes up I chose “ASP.NET Web Application” under “Installed\Templates\Visual C#\Web”
  • I entered the names for the project and the solution and clicked “Ok”
  • In the next dialog box I chose “MVC” from the ASP.NET 4.5.2 Templates section
  • I also checked the Web API references. I will probably not need them but added them in case I do keep some API endpoint on the site.
  • Set it to “No Authentication” as the site has no user login needed.
  • and then clicked “Ok” and let VS create the base solution.
  • next up was clearing out the views and controllers, and adding the ones from the old project.
  • then it was removing all references to the MeetingsService that the old site had to get the Meeting info from the database
  • Next was removing the DTO and domain entities references

I tried viewing the home page, and ran into some issues with the layout page and how it was doing the left navigation with passing HTML partial string to RenderSection. This was resolved by just moving the HTML from the partial into the main layout page. Now I could view the site. The various pages came up, it wasn’t pretty yet as I didn’t have any images for the site or the bootstrap referenced properly yet.

So after I got the images and bootstrap files added to the project, I tried publishing it to the web hosting provider. Unfortunately I ran into some small issues with this. I had to upgrade the server the hosting was on to latest IIS, and then the webdeploy tool didn’t have permissions to remove the previous files correctly so I had to manually delete all the files and then publish again and now the site is back up.


1 Comment

Modernization of NWVDNUG site

Today is my first day of some downtime between clients. Hopefully it’s short one. So today I was doing some learning and trying to figure out what to study. One potential opportunity for me is with an existing client and “modernizing” a bunch of their internal applications.

I also had some updates that needed to be done on the website for the user group I run with Barry Stahl. I had just in the past month, to move to a new work computer when the old one’s lease was up. Due to this fact, the Windows Virtual Machine on the machine used for windows development I had only installed Visual Studio 2015 on.

I connected to Github from inside VS2015 and cloned the repo for the website for my user group. But when I went to open it I got several issues from the conversion report. The main issue that was not able to be automatically updated by VS is the fact that I had written the site in an older version of MVC framework.

Following the link from the conversion report took me to MSDN article that had a link to:


So I figured I’d take on this “modernization” of the user group site as a learning tool in case this comes up for future work I have to do.

Following the steps on the linked page I did the following:

  • Update the version numbers in the Web.config files (steps 1 and 2)
  • For step 3 I couldn’t do as it wouldn’t even load into Solution explorer. I am skipping it and will come back to it later, if needed.
  • Did step 4 to edit the csproj file.
  • Replaced the guid as listed in step 5
  • In step 6, I saved the file but couldn’t reload it in VS. So I closed VS and tried reopening (with fingers crossed). It still wouldn’t show in VS, so I closed VS again and continued with step 7 for now.
  • Manually added/updated the code listed in step 7

I was hoping these steps would work, but it didn’t seem to. I didn’t want to do what it said was the easiest way to do it, “The simplest way to upgrade is to create a new ASP.NET MVC 4 project and copy all the views, controllers, code, and content files from the existing MVC 3 project to the new project…” I didn’t want to do this as I wanted to keep the current repo, and all this changes to a whole new project and file structure would be a mess of a commit.

Watch for second post soon, covering how simple this “simplest way” is.

Leave a comment

Task.Status refresher and thanks to Jeremy Clark

Last month (Sept 2015) at the user group I help run (http://nwvdnug.org) we had the pleasure of Jeremy Clark come out and give a talk on Task, Await and Async programming.

I’ll Get Back to You: Task, Await, and Asynchronous Methods

There’s a lot of confusion about async/await, Task/TPL, and asynchronous and parallel programming in general. So let’s start with the basics and look at how we can consume asynchronous methods using Task and then see how the “await” operator can makes things easier for us. Along the way, we’ll look at continuations, cancellation, and exception handling.

One of the things he covered was something I saw a fellow programmer at work run into. The issue is when a Task completes you have a couple properties “IsFaulted”, “IsCompleted”, and “IsCanceled” and the fact that IsCompleted just means it is done running and this is set to true even if faulted. Therefore you cant use it to tell that the task ran to completion SUCCESSFULLY.

I remembered in the talk this came up and was discussed and way to handle it nicely was given. I could not recall exactly the way Jeremy showed that handled it and went searching for more on his site. I found the following post


And reading through that post I found the information I wanted.

Thanks again Jeremy! And if you are near anyplace he speaks (which is LOTS of places) I would go see him. He is a really good presenter and covers his topics in a well organized way and really gets the concepts across well.

Check his site and his upcoming speaking is right on his home page.

Leave a comment

Great tip for testing web apps

I often ran into the issue when testing and debugging web applications and sites that I would often have to clear cookies and caches in order to effectively work.

This tip posted by Scott Hanselman is a good one, I had not heard of, let alone thought of. In his post he talks about adding Chrome in incognito mode and Internet Explorer in private mode to Visual Studio. Both of these effectively means any cookies or cached data you create during that session would/should be removed when you close that browser. This should make it easier than having to manually clear that data when testing.