The error I\'m getting is:
Type \'OrgPermission\' in Assembly \'App_Code.ptjvczom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\' is not marked as s
Leaving my specific solution of this for prosperity, as it's a tricky version of this problem:
Type 'System.Linq.Enumerable+WhereSelectArrayIterator[T...] was not marked as serializable
Due to a class with an attribute IEnumerable eg:
[Serializable]
class MySessionData{
public int ID;
public IEnumerable RelatedIDs; //This can be an issue
}
Originally the problem instance of MySessionData was set from a non-serializable list:
MySessionData instance = new MySessionData(){
ID = 123,
RelatedIDs = nonSerizableList.Select(item => item.ID)
};
The cause here is the concrete class that the Select returns, has type data that's not serializable, and you need to copy the id's to a fresh List to resolve it.
RelatedIDs = nonSerizableList.Select(item => item.ID).ToList();