Skip to content

Error with a really long and strange filename. #98

Description

@alkampfergit

If I'm trying to save a file with a really strange name I got that error

System.ArgumentException : The filename, directory name, or volume label syntax is incorrect.

Parameter name: path

I can replicate the bug changing each letter to an X,

"xxxxxx x xxx xxxxx xxxxxxxxxxx xxxxx xxx xxxxxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx xxxxx . xxxxx xxxxxxx xx xxxx xxxxxxx xxxxx xxxxx, xx xxxxxxxxxx xxxx xxxxxxr xxxxxx xxxx xx xxxxxxx 2 xxxxxxxxs xxx xxxx xxxxx xxxxxxxxxx xxx xxx xxxx xxxxxxxxxxxx xxxxx..eml"

Just create a console app with this code and you got a crash.

    internal class Program
    {
        static void Main(string[] args)
        {
            var tempPath = Path.GetTempPath();
            var fileName = Path.Combine(tempPath, "xxxxxx x xxx xxxxx xxxxxxxxxxx xxxxx xxx xxxxxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx xxxxx . xxxxx xxxxxxx xx xxxx xxxxxxx xxxxx xxxxx, xx xxxxxxxxxx xxxx xxxxxxr xxxxxx xxxx xx xxxxxxx 2 xxxxxxxxs xxx xxxx xxxxx xxxxxxxxxx xxx xxx xxxx xxxxxxxxxxxx xxxxx..eml");

            Pri.LongPath.File.WriteAllText(fileName, "Hello world");
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions