tkellogg / Jump-Location

Powershell `cd` that reads your mind
MIT License
467 stars 26 forks source link

Non-actionable error message in case if ~\jump-location.txt corrupted #53

Open MitjaBezensek opened 9 years ago

MitjaBezensek commented 9 years ago

I'm getting this error after installing Jump-Location:

Set-JumpLocation : The type initializer for 'Jump.Location.SetJumpLocationCommand' 
threw an exception.
At C:\Users\mitja.bezensek\Documents\WindowsPowerShell\Modules\Jump.Location\Load.ps1:
36 char:2
+     Set-JumpLocation -Initialize
+     ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], TypeInitializationException
    + FullyQualifiedErrorId : System.TypeInitializationException

I have tried the two suggestions for errors after install but none of those worked for me.

Not sure if it is related but I had Jump-Location installed via chocolatey (v0.5.1) which I uninstalled and then installed the new version (v0.6.0) via the Install-Module.

vors commented 9 years ago

Can you retrive Exception and InnerExceptions: $error[0].Exception $error[0].Exception.InnerException $error[0].Exception.InnerException.InnerException etc, until it's null

MitjaBezensek commented 9 years ago
C:\Users\mitja.bezensek> $error[0].Exception
The type initializer for 'Jump.Location.SetJumpLocationCommand' threw an exception.
C:\Users\mitja.bezensek> $error[0].Exception.InnerException
Row of file didn't have 2 columns separated by a tab
C:\Users\mitja.bezensek> $error[0].Exception.InnerException.InnerException
C:\Users\mitja.bezensek>
vors commented 9 years ago

Oh, I hit this one time as well, I thought it was during development. File with data corrupted, you can remove it with rm ~\jump-location.txt*

Thank you for reporting this!

vors commented 9 years ago

I renamed this issue and convert it to bug

MitjaBezensek commented 9 years ago

Yeah, this fixed it, tnx.

thebrianlopez commented 9 years ago

Fixed my issue -- thanks

vors commented 9 years ago

This problems happens quite often. I would say every 2-3 weeks.

dennisdoomen commented 9 years ago

Fixed it for me as well. :+1:

Porges commented 9 years ago

I just encountered this, jump-location.txt got replaced with 4628 NUL bytes...

codespare commented 9 years ago

Could it be caused when multiple PS console/ISE/other hosts are run concurrently? The mutex that guards the file against concurrent access derives its name from the executing assembly, which would have duplicates in that case.

vors commented 9 years ago

@codespare this is what we want: a global mutex should be used by all users of assembly to synchronize between each other.

I tried fix this part couple times and it became over-engineered, but still doesn't work correctly. The real problem is in using file as a database without a layer of abstraction that handles concurrency. Original design was not created to handle multiply instances at the same time. I started project https://github.com/vors/ZLocation to fix that. You can give it a try.

codespare commented 9 years ago

You are right, I got a little confused. One shouldn't try and troubleshoot concurrency issue after midnight, but my j key had suddenly broken and that was an emergency :) I also realized this had already been clarified in another issue after having posted my comment... Re-reading FileStoreProvider.cs, I still don't quite get things like the use of ownership:false constructing the mutex, or the Global scope prefix rather than Local. The Assembly Guid retrieval could also probably be via a string constant, and Save seems to assume nothing has changed since it was last called and looks like it would merrily overwrite intermediate changes having originated in another instance. But in any case, thank you for your suggestion, I'll go try ZLocation. Irrespective of that bug, this is just too useful of a tool to go without.

hmemcpy commented 9 years ago

Same thing happened: my computer BSOD'd on me, and the next reboot I got the same error. As with @Porges, my jump-location.txt is full of nul! Here it is, in case you want to repro yourself: https://dl.dropboxusercontent.com/u/2323661/jump-location.txt

latish commented 9 years ago

Same thing happened to me. Glad I found this :+1:

cmaughan commented 9 years ago

Yes, power failure here broke it on next boot.

vors commented 9 years ago

<ads> I released the first version of ZLocation, a Jump-Location successor, that doesn't have this particular problem. </ads>

Pharylon commented 8 years ago

This happens to me all the time. I have to clean out my jump-location info once a month or so.

uglycoyote commented 7 years ago

I got this error, and it was still non-actionable in 2017

martijnburgers commented 7 years ago

Same here. Happens often.

neraath commented 7 years ago

This has happened twice to me in the last month.

Greg-Smulko commented 6 years ago

Yes, it's quite irritating, it would be great to have it fixed.