I get the same kind of exception trying to get the UserAuthor from a blog. If i do something like
var author = (UserAuthor)blog.Author;
it works fine (because so far the author is always a UserAuthor), but when I try to be polite and check like:
var author = blog.Author as UserAuthor;
if (author != null) // BOOM
I get a stack overflow exception from EPiServer.Common.Framework.Impl.dll (no further details because VS can't give them to me when the stack is in overflow).
If I remember correctly, constructs like
UserAuthor author = null;
if (blog.Author is UserAuthor) { author = (UserAuthor)blog.Author; }
if (author != null) ...
work just fine, but my memory could be playing tricks.
Ah, then http://world.episerver.com/Download/Items/Hotfixes/EPiServer-Community/Hotfix-1---EPiServer-Community-32-SP1/ should solve your issues
[TestMethod]
public void CommunityAuthorTest()
{
//Any valid comment Id
const int validId = 1;
IComment comment = CommentHandler.GetComment(validId);
var author = comment.Author as GuestAuthor;
if(author != null) {//Exception at camparation
//Insert code
}
}