This is an InvalidOperationException
when calling the Serialize
method on an XmlSerializer
object.
The full message of the exception is: "The environment block used to start a process cannot be longer than 65535 bytes. Your environment block is 85754 bytes long. Remove some environment variables and try again."
This happens on a Windows 7 machine in a .NET 4.0 application trying to serialize an object that implements IXmlSerializable
. The actual object is irrelevant because it happens with a number of different object, complex and simple but not anything specific. It is also not reproducible and there is not much information on the internet about this particular (quite specific) error message.
- Does anyone know why this happens and in what state your machine needs to be in to reproduce this?
- What would the appropriate steps be (manually or programmatically) to correct the problem on the client machine.
Thanks in advance for any advice or solutions, this is the first time I've ever seen this occur and one of the few times I haven't found an answer on StackOverflow.