Rockford Lhotka

 Wednesday, June 1, 2016

csla win8_fullThis release of CSLA .NET is focused primarily on enhancing the existing Xamarin support. There is now a Csla.dll targeting PCL Profile111, which is the current profile for Xamarin.Forms projects and .NET Core.

There is also now a CSLA-Xamarin NuGet package that includes a Csla.Xaml.dll with support for Xamarin.Forms. This includes the same viewmodel base classes as the other XAML platforms, and an implementation of the PropertyInfo control tailored for use in Xamarin.Forms.

@JasonBock added even more analyzers for Visual Studio 2015 to help developers avoid common coding mistakes when building CSLA .NET business classes.

We now have support for the prerelease of Entity Framework 7.

The pt and pt-BR resources for Csla.dll have been updated. Other languages need updates as well - please contribute if you are a native speaker!

There is a new way to customize the server-side data portal by implementing an interceptor that is invoked via the new DataPortalBroker. (#564)

Full details:

The assemblies and packages are all available via NuGet.

Wednesday, June 1, 2016 9:33:18 AM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Thursday, May 26, 2016

th7JTBT6D7There is now a Csla.Xaml.PropertyInfo control for Xamarin Forms as well as WPF/UWP, so you can use the same technique to access all metastate about each property from your XAML.

This means that (now on Xamarin too) you can bind to the property value, as well as CanRead, CanWrite, IsValid, IsBusy, and various other metastate values.

Using this capability your XAML UI can provide the user with immediate and rich visual cues as to whether the user is allowed to read or write the property value, and whether the current property value is valid (and if not, why), as well as whether the property has any outstanding async business rules currently executing.

In short, all the goodness that WPF/Silverlight/UWP developers have enjoyed over the past many years is now available on Xamarin!

(or will be once CSLA .NET 4.6.400 releases in about a week – though you can try it now with the 4.6.400 prerelease available via NuGet)

Thursday, May 26, 2016 3:57:07 PM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Wednesday, May 25, 2016

The CSLA PCL that supports Xamarin includes an implementation of System.ComponentModel.DataAnnotations, and that includes numerous types, one of which is DisplayAttribute.

The PCL uses type forwarding so at runtime the platform's DataAnnotations implementation is used (if available), and the CSLA implementation is only used at runtime for platforms where there's not already an implementation (WinRT Phone is the only remaining platform afaik).

There is a problem with Xamarin however, where all types seem to forward and work fine except for DisplayAttribute. The problem in this case is that at runtime it seems that mono is unable to locate the correct ctor for the type:

"System.MissingMethodException: Method 'DisplayAttribute..ctor' not found.\n  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)\n  at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType, Boolean inheritedOnly) [0x00019] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:128 \n  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00040] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:158 \n  at System.Reflection.MonoProperty.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00000] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:317 \n  at Csla.Core.FieldManager.DefaultPropertyInfoFactory.GetFriendlyNameFromAttributes (System.Ty
pe type, System.String name) [0x00011] in <filename unknown>:0 \n  at Csla.Core.FieldManager.DefaultPropertyInfoFactory.Create[T] (System.Type containingType, System.String name) [0x00000] in <filename unknown>:0 \n  at Csla.ReadOnlyBase`1[T].RegisterProperty[P] (System.Linq.Expressions.Expression`1 propertyLambdaExpression) [0x0001c] in <filename unknown>:0 \n  at ProjectTracker.Library.ProjectInfo..cctor () [0x00000] in G:\\src\\rdl\\csla\\Samples\\ProjectTracker\\ProjectTracker.BusinessLibrary.Shared\\ProjectInfo.cs:10 "

This exception occurs when the consume app attempts to access the DisplayAttribute associated with a property to retrieve values from the attribute. It appears that mono is unable to create an instance of the attribute object because it can't find the ctor. The DisplayAttribute class has only a default ctor, but is typically initialized using named parameters, such as:

[Display(Name = "foo")]

I don't know what kind of ctor mono is looking for when it fails, but it obviously isn't finding the default ctor and then setting the property value, which is what would be the expected behavior.

I’m tracking this issue in the CSLA GitHub repo:

Steps to reproduce issue

The CSLA ProjectTracker reference app in my fork includes a repro of this issue. To see the issue, do the following:

  1. Clone my fork of CSLA from
  2. Checkout the 505-xamarin branch:
  3. Open the \Samples\ProjectTracker\ProjectTracker.sln solution
  4. Build the solution – it’ll pull down the CSLA .NET framework from NuGet
  5. Set a breakpoint in the XamarinFormsUi.ViewModels.ProjectList class as shown here
  6. Set the startup app to ProjectTracker.Ui.Xamarin.Droid
  7. Run the app in debug mode (on an emulator or device)
  8. On the first screen click the All Projects button

That’ll attempt to load the ProjectList page and ProjectList viewmodel. At this point the exception will occur and you’ll end up on the breakpoint because of the failure to create an instance of ProjectInfo, but that fails because mono can’t create an instance of DisplayAttribute (used on some properties in the ProjectInfo class).

Wednesday, May 25, 2016 12:51:26 PM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Friday, May 20, 2016

I might have found a bug in mono, but want to see if anyone thinks I'm missing something.

The CSLA .NET framework has long included an implementation of the System.ComponentModel.DataAnnotations namespace for platforms where Microsoft/Xamarin didn’t provide that functionality. These days I think that is only Windows Phone 8.1, but that includes PCL Profile111 (which is what Xamarin currently targets as well).

Of course the CSLA implementation includes the DisplayAttribute class, which is used to decorate properties in consuming classes like this:

[Display(Name = "blah")]

That "blah" value is a human readable name/label for a property.

Because mono actually provides a System.ComponentModel.DataAnnotations implementation, my PCL uses type forwarding so at runtime the PCL implementation is ignored in favor of the platform-specific implementation provided by mono. For example:

[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.DataAnnotations.DisplayAttribute))]

This works great on all platforms - except Xamarin Android/iOS where mono throws an exception because it can't find a matching constructor.

The thing is that the DisplayAttribute class has only the default constructor. The syntax being used to set the Name property of the attribute is supposed to use the default ctor, and then the Name property is explicitly set. This is a relatively old feature of C# - but I kind of suspect mono has a bug around this area, as it seems to be looking for a ctor that accepts a parameter when it should use the default ctor.

Friday, May 20, 2016 3:40:28 PM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Tuesday, April 26, 2016

thHU21A440There’s a lot of speculation at the moment, mostly I think from the tech press, that there’s no future for Windows 10 Mobile (aka Windows Phone). To the point that Terry Myerson apparently released a statement to clarify that Microsoft is committed to mobile for many years.

Over the past couple years I’ve been increasingly critical of Microsoft’s mobile strategy as well – it is hard not to be when the platform has such low market share, there’s been a lack of flagship devices released, and there’s still a major issue with apps (that don’t exist or that are quite poor compared to iPhone/Android versions).

So at the beginning of this year I “threw in the towel” and switched to the iPhone. This was after talking to a lot of people in person and via twitter about whether to go iPhone or Android. The overwhelming advice was that if you live in the US you should go iPhone, so I did exactly that.

After a couple weeks with the iPhone I wrote a comparison between Windows 10 Mobile and the iPhone – from my perspective. I’m selfish – I’m looking for a good answer for me, so my blog post was about me and my personal experience. After a couple more months I realized that this is a real tradeoff, because Windows 10 Mobile the operating system is more consistent and polished than iOS, but the apps on the iPhone are almost universally superior.

At that point I thought I’d try Android. This was right after Microsoft Build 2016, where it seemed like there was a lot of love for Android, and where I encountered a whole lot of my peers who were incredulous that I had an iPhone instead of an Android (where they were last fall when I was soliciting input I have no idea – I begin to suspect that people only advocate for their platform when you have “the other platform” in your pocket). Basically, some of the iOS frustrations and inconsistencies were bugging me enough I wanted to look elsewhere.

I didn’t even last a couple weeks on Android though. I bought a OnePlus 2 – a high-end device with very generic Android. It turns out that generic Android pretty much sucks – much like generic Linux. You need to spend (in my experience) hours and hours and hours researching and trying different launchers, lock screen apps, email apps, calendar apps, contact apps, etc. Just to get basic functionality that works out of the box in the iPhone and Windows 10. O.M.G. I don’t understand how people can waste that much time just getting the basics to work on their phones!?!

Now I’m back to Windows 10 with a Lumia 950xl. And I’m happy.

I keep hearing how Windows “lacks polish”. Clearly this statement is being made by people who have not actually used Windows 10, iOS, and Android back to back like I just did. In some ways iOS might have more polish, but it is far, far less consistent than Windows, so I give the OS polish nod to Windows 10. Android isn’t even in the running – it has no polish or consistency – though maybe with another many hours of research and testing I could have found a launcher that I liked? That’s not how I want to spend my life.

I also keep hearing about the Windows “app gap”. That is obviously a real problem. It is absolutely the case that the iPhone has a lot more apps, and almost all the apps are superior. It is also the case that the Android apps are plentiful, but they generally look like crap compared to their iOS counterparts. But I’ll give it to Android that, though its apps are inconsistent and often cartoonish, they are full featured, unlike Windows apps.

One other note on apps: Android is clearly designed to work well if you are a Google user (mail/calendar/contacts) and it is pretty half-baked for people not on Google. I can’t say I support the EU going after Google any more than I did when they went after Microsoft so long ago – I think that’s just dumb – but at the same time, I understand their consistent view here, because Google is using Android to drive usage and lock-in around their cloud service offerings, not unlike what Microsoft did 20 years ago with Windows.

Finally, I keep hearing how Windows phone hardware is inferior. I even heard that from someone at Microsoft. I’m skeptical. It is true that the iPhone 6s is a really nice device, and I love the fingerprint unlock feature. Android device quality varies a lot, but the OnePlus 2 is pretty nice (if a bit heavy) and has a fingerprint reader (if you can find a lock screen app that supports it). The Lumia 950 is nicer and lighter than the Android devices I’ve seen and used (including the Samsung ones). But I’ll grant that it isn’t as nice as the iPhone. At the end of the day though, I think all three platforms have hardware that are basically in the same ballpark: reasonably stylish, light, fast, with decent battery life, and great cameras. If it was just down to hardware my ranking would be iPhone 6s, Lumia 950, Samsung Android, other Android – in that order.

At this point though I’ll remind you that I’m selfish here – I’m after a solution for me.

That means it comes down to iPhone vs Windows 10 Mobile – the Android OS is too unpolished, clumsy, and inefficient; and its apps are too ugly, inconsistent, and cartoonish. It is clearly the cheapest platform, and you get what you pay for. I’m willing to pay to get a more productive experience.

And at the end of the day there are only 3 apps that don’t exist or don’t work on Windows that I actually need: Swarm, Waze, and the Parrott Bebop app for my drone.

My bank does have an app on iPhone/Android, but it sucks and so not having it isn’t really a loss. To solve my bank app issue I need to switch to a better bank, not a different phone.

I weighed the value of those 3 apps against Windows 10’s more polished and consistent OS experience; and I considered that Siri is like Cortana’s dullard older sister (yes, Siri is really an idiot compared to Cortana, and Cortana on the iPhone is crippled compared to Windows or Android).

Ultimately I’ve decided that I’d rather go with the best OS on a regular basis. In my case I’m fortunate enough that I can carry a second phone (sans SIM) so I can still fly my drone – it just needs the app and wifi after all. That also gets me Waze and Swarm, because they also work over wifi, and my Lumia works great as a wifi hotspot when I’m out and about.

At the end of the day, until Foursquare, Google, and Parrot (and my bank) get their heads out of their @$$’s I am working around them via a two phone solution.

But most importantly, I’m happy using Windows 10 and Cortana for my 99% use case of email/calendar/phone/text/messaging/Office/etc.

And fwiw, I think the continued rapid adoption of Windows 10 itself (on my Surface and Desktop for example) will drive more and more companies to create UWP apps – perhaps not initially for the phone, but at least for the 300 million (and climbing) people running Windows 10. The thing is, once your app runs in UWP, getting to the phone is a pretty small step – and one companies would be foolish not to do for such little effort.

Tuesday, April 26, 2016 3:46:05 PM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Thursday, April 14, 2016

Earlier this year I embarked on an “adventure”. I was frustrated with the lack of apps on Windows Phone (Windows 10) and I keep hearing how magical the iPhone is for people. After a couple weeks with the iPhone I wrote a comparison blog post: Windows Phone vs iPhone comparison

More recently I wrote about my ongoing frustrating with the iPhone, justifying why I was going to try an Android device: iPhone frustration

I’m trying to give each platform a fair try, but after a few short days with Android (I have a OnePlus 2 – so very “vanilla” Android) I’m already finding that of the three operating systems Android is the worst. It is kind of like desktop Linux – cobbled together by a lot of people who don’t share a common vision, so everything sort of works, but nothing feels consistent and most things don’t seem professional or polished. Kind of the diametric opposite of the iPhone.

I’ve always thought that you get what you pay for, and I think Android reinforces that worldview. It is cheap, the devices are cheap, the apps are free or cheap. And they all feel cheap when compared to Windows 10 or iOS. But if your phone isn’t a budgetary priority in your life, yet you need a smartphone, then Android is probably the right choice – which explains why it is the most popular OS globally. Clearly the majority of the world’s population either can’t afford a professional phone/experience (which is largely true of course), or they don’t value their own time as much as money, so they are willing to invest that time dealing with Android instead of spending the extra money up front to get an iPhone or Windows Phone.

Notice that I’m still putting Windows Phone in this discussion, even though it has a low US market share, and only a slightly better global market share. In my experience with the three platforms thus far, my conclusion is that the operating systems rank like this:

  1. Windows 10
  2. iOS
  3. Android

The physical devices I’ve been using rank like this:

  1. iPhone 6s
  2. Lumia 950xl
  3. OnePlus 2

The availability and quality of apps rank like this:

  1. iOS
  2. Android
  3. Windows 10

If you assign numeric scores to each category, you end up with the following overall ratings:

  • iPhone (8)
  • Windows 10 (6)
  • Android (4)

So at least in my opinion – based on how I use my phone and what I expect out of it – I probably should keep using my iPhone, and keep grumbling about how dumb Siri is compared to Cortana. Or I should go back to Windows 10 and deal with the sad reality that it doesn’t have workable Waze, Swarm, or banking apps.

A lot of people I know do carry two phones (personal and work). I’m sort of considering carrying 2 devices – a Windows phone with a SIM as my primary (so I have Cortana and all the other stuff I love about Win10) and an iPhone without a SIM to run the apps that don’t exist on Win10, because they all run over WiFi. Just a little twist on the work/personal dual phone scenario – but in my case I’ll have one phone that’s fun to use (Win10), and one phone that runs apps that are fun to use (iPhone).

Thursday, April 14, 2016 8:53:23 AM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Friday, April 8, 2016

thO531UYN9Earlier today I tweeted that I have an Android phone on order, because I’m frustrated with my iPhone.

Not surprisingly that resulted in people wondering why I’m frustrated.

My iPhone experience started in mid-January when I switched from Windows 10 Mobile to iOS because I was frustrated by the lack of apps on my Windows phone. A couple weeks later I wrote up my Windows Phone vs iPhone comparison. After a couple more months of using the iPhone I stand by what I wrote in that post – Windows 10 is far superior to iOS, but the lack of apps on Windows phones is crippling.

But there are some things that really bug me about the iPhone – frustrations I face literally every day. Most notably:

  • No live tiles – man do I miss live tiles!
  • Cortana on the iPhone is crippled, and Siri is an idiot
  • The “back navigation” concept on the iPhone is ridiculously inconsistent and poorly implemented
  • The concept of sharing from one app to another is robust on iOS, but is also ridiculously inconsistent and convoluted
  • So many things that are simple on Win10Mobile require a lot more taps/swipes/effort on iOS

I know that Android won’t solve or address all these issues. Maybe it won’t address any of them, I won’t know until I try it. And I say that based on my experience switching to the iPhone; everybody prioritizes different features and abilities differently, so I find it virtually impossible to get at the “reality” of each OS by talking to other people.

Here’s what I think I will find on Android:

  • No live tiles – still my number 1 issue with any other phone OS
  • Cortana on Android is reputed to be much better than iOS; almost as good as Windows; and the new Windows 10 Anniversary Edition mobile integration features work with Android as well as Windows 10 Mobile (but not iOS)
  • Android has a back button, so I am hopeful the “back navigation” experience will be more consistent than iOS (which is, frankly, a very low bar)
  • I don’t know what to expect about inter-app sharing, but I suspect Android is no better than iOS (and let’s be honest, this is also a weak spot for Windows phones)
  • I also don’t know that Android will be as optimized for common tasks as Win10, but I can’t imagine it will be more awkward than iOS

At the end of the day though, my three daily frustrations are simple:

  1. Live tiles (and the lack thereof)
  2. Cortana
  3. Consistent navigation patterns (especially the back navigation concept)

Android seems to have a good chance of addressing two of the three, so perhaps I’ll be happier day to day than I am with the iPhone?

I guess time will tell. At least I’ll be able to know first-hand how all three mobile operating systems work for me.

Friday, April 8, 2016 2:58:49 PM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Monday, April 4, 2016

I’ve never posted one of these “opening the box” type blog posts before, but I took a bunch of photos as I opened my new Hololens on Saturday and thought I’d share.

At Build 2016 Microsoft’s Alex Kipman announced that the device was officially shipping. Within 15-20 minutes my phone chirped to give me the tracking number of the package. Seriously, they must have had people waiting on the loading dock to ship as soon as the keynote announcement occurred! As a result, two devices were waiting for me as soon as I got home from San Francisco Smile

Well, really they are for my team at Magenic – but I got to spend the weekend with the device Winking smile

The device came nicely packed in a shipping box that contains the product box:


Not only did the shipping box include the Hololens, but also a clicker (single button remote):


It is clearly labeled as a developer device:


Inside the Hololens box itself is a nice carrying case for the device, and inside that is the device:

20160402_223837348_iOS   20160402_223955345_iOS   20160402_224030877_iOS

The center of the carrying case includes some more items:

20160402_224640751_iOS     20160402_224816821_iOS     20160402_225029392_iOS


  1. A second node pad in case the default doesn’t fit well
  2. A micro-USB cable for charging and connecting to your Windows 10 development PC
  3. An optional overhead strap if you need that to make the device fit/feel better
  4. A wall charger (AC power to USB)
  5. A microfiber cloth to clean the lenses of the device

Here are some shots of the device itself:


20160402_224049143_iOS  20160402_224156940_iOS  20160402_224224939_iOS  20160402_224251471_iOS  20160402_224531303_iOS

On twitter and other places people have asked a few common questions.

How long does the battery last?

So far my experience seems to indicate that Microsoft’s stated 2.5 hour estimate is about right. I haven’t run it dead yet, but it seems like 2.5 hours is about right.

How is the field of view (FOV)?

Microsoft actually describes this as the ‘holographic frame’, and I’d say it is about the same as if you held an iPhone 6s about 15 cm (6”) in front of your face. Which is to say that it doesn’t appear in your peripheral vision, but does dominate your forward vision area pretty well.

Is it comfortable to wear?

It takes some getting used to, that is for sure. It isn’t uncomfortable, but it does take a while to get used to the feel of the device, as well as how it impacts your vision. After wearing it a few minutes I personally am finding that it becomes like a “new normal”.

Can you wear glasses and use the device?

Yes. However, I do think that people like me who have progressive lenses in their prescription glasses are at a bit of a disadvantage, because the lower part of my vision isn’t in focus and so I’m forced to tilt my head to look at the lower parts of holograms or 2d displays. Fortunately for me I am far sighted, so I can use the device without my glasses (because the projections are always far enough away that they are beyond where I need glasses to see clearly), but I suspect this may be a problem for other people, especially those who are near-sighted and still have progressives.

It is as cool as it seems?

That’s obviously subjective, but I’m going to go with yes. Even in a simple scenario where I pin multiple 2d apps to the walls around my office, it is pretty darned neat to look around at an office covered in live displays of various sorts (images, youtube videos, web sites, etc.).

While at Build 2016 last week I was able to participate in the Hololens Academy. This experience probably best describes why I think Hololens is as cool as it seems.


At the end of that event our holographic demo resulted in an “explosion” that “blew a hole in the floor”. Even though the 3D models and textures were intentionally unrealistic, the illusion was so real that our brains literally didn’t want to have us lean over the hole too far for fear of falling in. Sure, we rationally knew this was an illusion, but some part of my brain was screaming that the hole was deep enough that I didn’t want to fall.

Yeah, really!


There’s no doubt in my mind that Hololens will make a big difference in many scenarios where we want computing power, and we want our hands free, and we want to augment reality. I’m sure this will include gaming, but also medicine, probably inventory, manufacturing, insurance estimation, home improvements, many sales scenarios, and a whole lot of other areas I’m not listing here.

If you or your users interact with the real world while carrying around a phone/tablet/PC so you can simultaneously interact with a computer system, it seems reasonably likely that Hololens has the potential to make that process smoother and easier.

Monday, April 4, 2016 10:08:54 PM (Central Standard Time, UTC-06:00)  #    Disclaimer