1
Vote

Locating Client chokes on invalid PATH

description

I had a problem with a user of my software reporting crashes when they tried to use Mercurial.Net functionality, I think I've tracked this down to an invalid part of their PATH variable causing Mercurial.Net to choke when it tries to locate the client.

The path contains (among other things) this:
/c/Program Files (x86)/GnuWin32/bin

The stacktrace submitted to me was this:
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at Mercurial.Client.<LocateClient>b__5(String path)
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at Mercurial.Client.LocateClient()
at Mercurial.Client.LazyInitialize()
at Mercurial.Client.get_CouldLocateClient()
at Mercurial.Repository..ctor(String rootPath)

comments

martindevans wrote Jun 22, 2012 at 2:44 PM

I just noticed, along with the invalid path I pasted above, every single path in his PATH variable is surrounded with speed marks ("), so every single element in the PATH is invalid!

lassevk wrote Feb 18, 2013 at 3:46 PM

Thanks, I will add some sanity checks to this part of the code to ensure Mercurial.Net at least not crashes.

The project has unfortunately fallen a bit by the wayside for me, but I'm picking up development again these days so hopefully it won't take too long until I can release a new version.