Warning in Resharper "Return value of pure method is not used"

In your sample code you catch Exception which can be any of the following: ArgumentException, SecurityException, ArgumentNullException, NotSupportedException, PathTooLongException, but the one that is being thrown when path contains invalid characters is only ArgumentException MSDN.
Furthermore,

I am using Path.GetFullPath(path) only for the purpose of catching all exceptions to do with invalid characters.

you should rather use the following code, and omit the exception handling:

foreach (char invalidChar in Path.GetInvalidPathChars())
{
    if (userInputPath.Contains(invalidChar))
    {
        return true;
    }
}
return false;

Nope, that should not cause any problems for you, as this is in fact how you do want to use it.

The Resharper hint in this case is just a pointer in case you've forgotten to create a variable in which to keep the data you've fetched. Since you're just validating, and don't actually need that data, you should be fine.

Edit: Note that you can avoid the hint, and make it clear that this is on purpose by using a specific Resharper comment, like this:

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
Path.GetFullPath(userInputPath);

Edit #2: SynerCoder is probably right though, about System.IO.Directory.Exists() being a better option for your specific purpose...


You should not use your own method for checking if the path is illegal. Since you are checking a directory (inputDirectory) you should use the following code:

if (!System.IO.Directory.Exists(inputDirectory))
{
    return;
}