LinqPad7 not stateless between runs

Could it be that Linqpad7 (maybe the older ones too), is not complete stateless between two runs of the same code?
If I use e.g. the MongoDB.Drive 2.16.0 and put the following line in a C# Program:

BsonSerializer.RegisterSerializer(new GuidSerializer(GuidRepresentation.Standard));

I get a BsonSerializationException('There is already a serializer registered for type Guid.') the second time I start the program.
If I close LinqPad and start over the it is working again until the second run.


  • That's right: LINQPad re-uses the process as a performance optimization and to enable caching of data between runs with Util.Cache. You can disable this globally in Edit | Preferences > Advanced or per-run with the following code:

    Util.NewProcess = true;
Sign In or Register to comment.