Windows Application Development Cookbook Error Help

If you, like me, purchased the Windows Application Development Cookbook and are working through the examples you may find that you get an error on the Introducing Bindings and commands in the MVVM and Data Binding section.

Suppression State Error CS0619 ‘ImplementPropertyChangedAttribute’ is Windows Application Development Cookbookobsolete: ‘This configuration option has been deprecated. The use of this attribute was to add INotifyPropertyChanged to a class with its associated event definition. After that all classes that implement INotifyPropertyChanged have their properties weaved, weather they have the ImplementPropertyChangedAttribute or not. This attribute was often incorrectly interpreted as an opt in approach to having properties weaved, which was never the intent nor how it ever operated. This attribute has been replaced by AddINotifyPropertyChangedInterfaceAttribute.’

The error is somewhat self explanatory and the answer is right there in the text but it wasn’t immediately clear to me, a MVVM novice, on how to fix it. So after a little Googling and some trial and error I was able to finish the recipe by changing the

[ImplementPropertyChanged]

in the recipe to

AddINotifyPropertyChangedInterfaceAttribute

While that worked for the sample in the book I didn’t think that was the correct (or complete) answer. So I did a little more experimenting and found that if I commented out the attribute above the class name and added INotifyPropertyChanged to the end of the class name it also worked.

//[AddINotifyPropertyChangedInterfaceAttribute]
public class MainViewModel : INotifyPropertyChanged

I have no idea of the differences between the two or if I am still doing something wrong but the second one feels like the correct version because it fits the more common model I have seen in sample code.

If you know the difference between the two or what the more correct modification is please leave a comment because I would really like to understand the differences. I have did a little searching on my own but couldn’t find anything definitive.

Oh and don’t forget to add the following to the page.

public event PropertyChangedEventHandler PropertyChanged;

Little ASP.NET Core Book

Every since ASP.Net Core was released I have been chomping at the bit to convert my MVC learning project, Northern Dog Site, to a MVC Core site. I started to do the conversion early on but I had too many problems with the transition from the first release and then to 1.0 and finally 1.1 that I decided to wait it until the platform stabilized a little before going too deep into it.

So with the recent release of MVC Core 2.0 I feel that there is now some stability with the platform and the tooling so it was finally time to take the deep dive. However doing a quick search on Amazon I find there aren’t any books, available right now, that contain 2.0 content. So getting started now means relying on the few tutorials on Microsoft’s site that have been converted to 2.0. While that is better then nothing I really prefer reading from a book and working through a project chapter by chapter.

Unfortunately most of the books listed for purchase on Amazon aren’t slated to come out until spring of 2018, which meant I was just going to have to be patient. Well that was until this showed up in my Twitter Feed

The Little ASP.Net Core BookI wrote this short book to help developers and people interested in web programming learn about ASP.NET Core 2.0, a new framework for building web applications and APIs.

This short (and free!) book is structured as a tutorial. You’ll build an app from start to finish and learn:

  • How to build a web app with the ASP.NET Core framework
  • The basics of the MVC (Model-View-Controller) pattern
  • How to read and write data to a database
  • How to add log-in, registration, and security
  • How to deploy the app to the web

Don’t worry, you don’t need to know anything about ASP.NET Core (or any of the above) to get started.

It’s everything I wanted in one package. And it’s free. Perfect! Check it out yourself here on the book’s website.

Visual Studio Code

Visual Studio Code LogoSo by now I have definitely heard the buzz around Visual Studio Code. I even downloaded and kicked the tires the same day the public beta was released. It’s just that I spend most of my time building desktop applications so I didn’t see what the big deal was and I was never drawn to it. I did use it on a regular basis as a Notepad replacement so it was top of mind when I had a project where I had to work on some HTML5.

So I tried it as a HTML editor and still wasn’t all that impressed with it (at first). All that changed after I added a few extensions, changed the theme  and altered the default font.

Visual Studio Code Window

Now it is absolutely my favorite tool for working with HTML, CSS and JavaScript. The Intellisence is fast and useful, there a vast number of extensions that make it even better, it includes a built in debugging tool and the best part is that it is completely free,

You can get an idea of the its power and extensibility by checking out the Visual Studio Code Marketplace. So far my favorite extensions are

  1. Auto Close Tag
  2. C# for Visual Studio Code
  3. Custom Theme for Visual Studio Code
  4. HTML CSS Support
  5. HTML Snippets
  6. Live HTML Previewer.

I am sure there are other great extensions and can’t wait to dig deeper into the marketplace to find some of them.

For the most part I live in Visual Studio Professional and I don’t see this tool changing that for the majority of my work. However this is currently my number one choice for, I hate to say, light editing work. And to be clear I hate to say it because it is more then just a light weight text editor. It is an extremely powerful editor with professional features. So I won’t claim that it is a “must have” tool but I will say that it’s definitely a “must try” tool.

Oh and I should mention that its a cross platform editor that will run on Windows, Linux and Apple.

 

 

 

Things to do in 2017 (Not a Resolution)

Every year I try to set a few goals around software development that help push my skill set up to the next level. In 2016 it was MVC and ASP.Net Core, which didn’t Things to do in 2017 work out for me because when I started my journey down that path ASP.Net core wasn’t fully baked nor was the tooling completely ready for prime time.

I purchased two separate books to learn ASP.Net Core and both were early release books so I expected there would be some changes, debugging and tweaking that would need to be done to get the sample code working. However I ended up spending all my time trying to get the project up and running like the one in the book. So much so that I decided to abandon it for now and just wait for Microsoft to finish with the tooling before I tried again.

The other thing I decided to work on in 2016 was the Windows 10 Universal Platform, which I have had much better success with. I am feeling pretty good about the environment now and have just added MVVM to my skill set. Should the platform ever take off I feel like I will be well prepared to take advantage of it.

So for 2017 I have decided to build on the Universal Windows Application knowledge and delve into the Xamarin platform. Although I will be limited to Microsoft and Android because, for now, I do not have any Mac devices, which is a requirement for building applications on the IOS platform.

Next and something I have never considered before is game development. Well, at least, I am committing to leaning how to use the Unity 3d tools for game development. At this point in my career I don’t expect that I will ever actually build and release an original game to any marketplace. I can, however, see building training tools with Unity to use in corporate environments that run on the desktop and possibly in 3d.

So that covers 2017 and I can’t wait to see what this year will bring for 2018!

Windows 7 Update Never Stops Checking for Updates

Recently I was tasked with staging some Windows 7 machines that needed to have all the updates, since Service Pack 1 for Windows 7 was released, installed. However on all four machines the were stuck in a mode where the Windows 7 update never stops checking for updates. In the first instance I let the search go on for 30 hours before I cancelled it.

They were all new machines that came with Windows 7 Professional Server Pack 1 pre-installed. They happened to all be Hewlett Packard Desktops but I think that is irrelevant to the problem I was having.

Windows 7 Update Never Stops Checking for Updates

Per a Google I found several sights with suggested fixes but nothing worked. That is until I found this on a Microsoft Answer site, which I am posting here so that I can find it later should I need it and so that it may help someone else with the same problem.

The first step, which none of the of the sites from the early searches ever mentioned was to download the Windows Update Client from Microsoft’s support site. You can go to the site yourself by typing this into your location bar

https://support.microsoft.com/en-us/kb/3138612 Or go directly to the page via this link Windows Update Client for Windows 7 and Windows Server 2008 R2: March 2016

There are versions for Windows 7, Sever 2008 in both 32 and 64 bit so make sure you select the correct download for your version of Windows. Once you have the file downloaded but before you run it. Open a Command Prompt as an administrator by right clicking on it and selected “Run as administrator”

Run as Admin

Once the command window is open type: net stop wuauserv

Command Prompt Window

 

 

 

 

 

 

 

You should get a message similar to the one above (although the screen shot comes from a Windows 10 machine and not 7) noting that the service was stopped successfully.

With a success message you can now run the downloaded program from earlier. After the installation is complete, reboot your computer and then try the Windows Update again.

In my case, for these particular machines, this suggested fix took care of the problem. However your mileage may vary.

UWP Community Toolkit

The UWP Community Toolkit is a collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer tasks building UWP apps for Windows 10.

The toolkit can be used to build UWP apps for any Windows 10 device, including PC, Mobile, XBOX, IoT and HoloLens. You can also use the toolkit with an existing desktop app converted to UWP using the Desktop Bridge.

The UWP Community Toolkit is available as a Visual Studio NuGet package for new or existing C# and VB.NET projects. Read the Getting Started page for all the details.

You can also preview the capabilities of the toolkit by downloading the UWP Community Toolkit Sample App in the Windows Store.

UWP Community Toolkit logo

Go here for more information about the UWP toolkit. The downloadable application shows all the controls in action and provides all the sample code you need to get started. The project is open source and hosted on GitHub so there is no monetary cost to the end user to use them, the source code is freely available and you can contribute your own controls back to the community.

If you don’t want to download the sample application to your computer you can also check the samples out at the Toolkit Documentation part of the site.

Currently I haven’t had a chance to use them in any of my current projects because I mainly work in WPF. However I have one active project that I plan to use a few of them with in the next month or so.

I do wish that Microsoft had found a way to have some kind of forward / backward compatibility from WPF to Windows 10 UWP applications because I prefer the UWP way to do things. In fact so much so that I would give up a lot of what WPF has to offer to adopt it completely but the apps I build for work run on about 70 different computers  and only about 10% happen to be running Windows 10. So it isn’t really even an option for me outside of a few sample / proof of concept applications.

ASP.Net Core Developer

ASP Net Core logo
ASP.Net Core Developer: Today marks the beginning of the next phase of my development career. Actually it’s somewhat of a completion of the circle because I started out thinking I was going to be a web developer, which was sometime around 1997 (Wow! That was almost 20 years ago). At that time I was using an early version of Front Page working with static html.

It wasn’t long after I started that I found a technology, at the time, called Active Server Pages which allowed a me the ability to do dynamic content. I was hooked and I dove deep into it. I immediately went to the local Barnes and and bought a Teach Yourself Active Server Pages in xx hours/days (or some unrealistic time frame) and worked through the entire book. I learned a lot from that book and really enjoyed working with the technology.

The problem that I had and the reason that I left the web developer path was a pesky little technology called JavaScript. At the time I could do a lot with ASP but it was clear to me that all the cool stuff on the web was being done with DHTML, which was the term at the time for HTML, JavaScript and CSS. I tried to learn JavaScript multiple times and it just never took hold for me.

So by accident, around 2001, I stumbled into desktop development, loved it and never looked back. I started with a MS Access/VBA project, later moved to a VB.Net projects with SQL server and did that up until about 5 years ago where I transitioned to C# and WPF when it became available.

In the last 20 years a have dabbled, from time to time, in the web dev world but always bumped up against JavaScript and lose interest. When Microsoft started promoting MVC I decided to try again I found that I really like the model, which for me timed pretty close to the time that JavaScript was being made better by the libraries/frameworks that were being built around it to make up for any short comings that came with vanilla JavaScript.

So I continued to dabble in it for several years but never found a compelling reason to step out of the comfort of desktop development and into web development. However with Microsoft’s announcement of ASP.Net core (formaly ASP.Net 6) my interest has been ignited again, and with all the mature JavaScript libraries out there to choose from I think this time it is going to stick.

My Developers Life

Mock UpsLifted it from Don’t Hit Save.

In four panels this describes my life as a developer. 😉 As soon as I seen this I had to re-post it because I have lived this. Over and over. Although (somewhat) tongue in cheek it is one of the reasons that I don’t like to show early prototypes (or mock ups) to the end user. For whatever reason people like to focus on the look of it and ignore the feature set. I am sure that it is because it is much easier to hone in on the concrete and less on the abstract. But that doesn’t ever change the let down I feel when I show a non developer some feature that I have worked on that pushed the limits of what I could do and all they see is the font, color scheme, etc.

And for the record this is not a complaint. I absolutely love getting to solve complex problems with code. So much so I wish I was better at it.