问题
I crashed LinqPad while crafting something slightly less than trivial. I don't want to restart it until I'm sure that won't jeopardise recovering my work (if this is possible). My question is: Does LinqPad write temp files anyware that might still contain the code I wrote?
For posterity, here's a test case that crashes LinqPad every time (also posted to LinqPad forum):
void Main()
{
Crasher.Crash();
}
class Crasher
{
public static void Crash()
{
var a=0;
Crash();
a++; //let's get something in the tail so compiler
//doesn't optimise tail recursion and prevent
//stackoverflow
}
}
回答1:
Before the crash did you happen to run it once? If so it would've been compiled and should be available as a dll that you can open with .NET Reflector.
Check the LINQPad temp folder, for example: C:\Documents and Settings\username\Local Settings\Temp\LINQPad
. Sort the files by modified date then check a few of the dlls in Reflector till you find your query. It probably won't resemble your query exactly but it should be good enough for you to salvage your code.
UPDATE: an auto-recovery feature has been added to LINQPad (Beta, at the time of this writing). To my knowledge it has been available in the Beta version as early as v4.28.3. Get the beta to take advantage of it, or it may already be in the release version for future readers of this post. If LINQPad is launched after it crashes it will throw a dialog up asking whether or not you would like to recover unsaved queries.
来源:https://stackoverflow.com/questions/3915636/linqpad-just-crashed-on-me-is-my-code-anywhere-on-the-disk