As with all good intentions, it didn't take me long to get to hell. Specifically the following methods kept failing with some meaningless guff about object reference not being set to an instance etc.:
My original code was:
var roles = Roles.GetRolesForUser(userName);To cut a long story short, I called the method on the Provider property of the Roles object like so:
var provider = Roles.Provider; Debug.Assert(provider != null); var roles = provider.GetRolesForUser(userName);Now all is well again.