The garbage collector keeps disposing my shader.

When I minimize my game and then unminimize it, I keep finding that my shader has been Disposed (resulting in a crash).

The shader in question is

public static Effect colorSwap;

I'm using XNA- and Effect is an XNA class.

How do I prevent it from being disposed? GC.KeepAlive isn't doing the trick.


by Eldiran via /r/csharp

Leave a Reply