0

We are attempting to go out-of-proc for session state, and need to mark the classes we intend to store in session as Serializable, of course.

Is there any way to automatically determine which classes should be marked as Serializable, without resorting to full regression testing of the site to flush them out via yellow screens?

Mark Richman
  • 28,948
  • 25
  • 99
  • 159
  • Iam not sure of the built in method, but you should be able to identity types that are assigned to session, and then write a program to recursively go through members and identify reference types that are non serializable (dont have attribute, or ISerializable implementation) – np-hard Jul 18 '11 at 21:01

1 Answers1

1

Check this out ;)

    [Serializable]
    public class SessionObject
    {
    }

    static void Main(string[] args)
    {
        bool isSerializable = typeof(SessionObject).GetCustomAttributes(typeof(SerializableAttribute), false).Length != 0;
    }
dknaack
  • 60,192
  • 27
  • 155
  • 202