Using Custom Identities in ASP.NET fails when using the ASP.NET Developement Server - by Paulo Morgado

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 274696 Comments
Status Closed Workarounds
Type Bug Repros 20
Opened 4/29/2007 12:32:09 PM
Access Restriction Public


When using custom identities (classes that implement System.Security.Principal.IIdentity) and the ASP.NET Development Server a SerializationException is thrown.
Sign in to post a comment.
Posted by BaggaDonuts on 6/28/2012 at 2:18 PM
Here's how you fix this issue. First, mark your class as Serializable. then implement the ISerializable interface:

/// <summary>
/// Stubs identity for offline authentication
/// </summary>
public class StubIdentity : IIdentity, ISerializable


public void GetObjectData(SerializationInfo info, StreamingContext context)
    if (context.State == StreamingContextStates.CrossAppDomain)
        GenericIdentity gIdent = new GenericIdentity(this.Name, this.AuthenticationType);

        System.Reflection.MemberInfo[] serializableMembers;
        object[] serializableValues;

        serializableMembers = FormatterServices.GetSerializableMembers(gIdent.GetType());
        serializableValues = FormatterServices.GetObjectData(gIdent, serializableMembers);

        for (int i = 0; i < serializableMembers.Length; i++)
            info.AddValue(serializableMembers[i].Name, serializableValues[i]);
        throw new InvalidOperationException("Serialization not supported");
Posted by jvella1975 on 6/27/2012 at 4:29 AM
Come on microsoft .. this bug has existed for five years and through 3 (about to be 4) versions of visual studio ... fix it or explain why you won't/can't.

"Your feedback improving Microsoft products" <-- yeah .. apparently not so much :(
Posted by Reto Ghioldi on 5/21/2012 at 12:58 AM
"We will consider this issue again in a future release."...

Will this issue be fixed in Visual Studio 11? Hope so! :-)
Posted by BLoritsch on 10/5/2010 at 11:29 AM
This problem not only still exists, it also affects IPrincipal classes. When your IPrincipal is implemented using Linq to Entities, none of the provided workarounds can work. I can't change the inheritance hierarchy to include MarshalByRefObject. The IIdentity workaround no longer works because it is an IPrincipal. And I'm using C#, not VB so that workaround does not work.

If this bug cannot be fixed, it would help to understand what is preventing the ASP.NET development server from functioning properly.
Posted by mt1337 on 3/19/2010 at 10:48 AM
Oh I see MS has closed the issue and has no interest in fixing it "for this release" (whatever that means).

How cute.
Posted by mt1337 on 3/19/2010 at 10:47 AM
Is Microsoft going to fix this bug, EVER? It's 2010, and VS 2008 with SP1 has the issue still.
Posted by Travis Illig on 1/29/2010 at 3:38 PM
This happens while using Microsoft.IdentityModel.Claims.ClaimsPrincipal, too. Apparently claims-based auth systems won't be supported on the dev server.
Posted by Microsoft on 6/29/2007 at 3:36 PM
Thank you for your feedback. We are aware of this issue and are not planning to address this in the ASP.NET Development Server for this release. We will consider this issue again in a future release.

The Web Tools Team
Posted by Microsoft on 5/3/2007 at 1:23 PM
Thanks for submitting this issue. We are investigating.

The Web Tools Team
Posted by Microsoft on 4/29/2007 at 11:32 PM
Thanks for your feedback. We have reproduced this bug on Win2003 SP2 and OrcasBeta1VSTS, and we are sending this bug to the appropriate group within the Visual Studio Product Team for triage and resolution. Thank you, Visual Studio Product Team.
Posted by Microsoft on 4/29/2007 at 6:31 PM
Thank you for your feedback. We are currently investigating. If this issue is urgent, please call support directly (see Thank you, Visual Studio Product Team.
Posted by Paulo Morgado on 4/29/2007 at 2:13 PM
If anyone wants to try this, he/she can read this blog post ( and download the sample.