We're updating the issue view to help you get more done. 

System.IO.PathTooLongException

Description

When saving a screenshot, very long paths can cause the file to not be saved because the maximum length of characters for a path is exceeded under Windows. At this point Greenshot gives an unhandled error message with an exception:

System.IO.PathTooLongException
Message: The specified path and / or file name is too long. The fully qualified filename must be shorter than 260 characters and the pathname shorter than 248 characters.

It would be desirable if Greenshot already checked automatically when entering the file name or clicking on the Save button in the "Save As" dialog, how long the complete path including file name is. If the complete path is too long, a message should be displayed to shorten the path or the file name. But under no circumstances may or should Greenshot eject a System.IO.PathTooLongException error message.

Software version: 1.2.10.6-RELEASE-c2414cf0149a1475ea00520effc01b40087c225c (64 bit)
.NET runtime version: 4.0.30319.42000+
Time: 2019-07-03 13:48:43 +02:00
OS: unknown (x64) 10.0 build 17763 revision 0
GDI object count: 200
User object count: 122

Exception: System.IO.PathTooLongException
Message: Der angegebene Pfad und/oder Dateiname ist zu lang. Der vollständig qualifizierte Dateiname muss kürzer als 260 Zeichen und der Pfadname kürzer als 248 Zeichen sein.

Stack:
bei System.IO.PathHelper.GetFullPathName()
bei System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
bei System.IO.Path.GetFullPathInternal(String path)
bei System.IO.Path.GetFullPath(String path)
bei System.Windows.Forms.IntSecurity.UnsafeGetFullPath(String fileName)
bei System.Windows.Forms.IntSecurity.DemandFileIO(FileIOPermissionAccess access, String fileName)
bei System.Windows.Forms.FileDialog.get_FileName()
bei GreenshotPlugin.Controls.SaveImageFileDialog.get_FileNameWithExtension()
bei GreenshotPlugin.Core.ImageOutput.SaveWithDialog(ISurface surface, ICaptureDetails captureDetails)
bei Greenshot.Destinations.FileWithDialogDestination.ExportCapture(Boolean manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
bei Greenshot.ImageEditorForm.DestinationToolStripMenuItemClick(Object sender, EventArgs e)
bei System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
bei System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
bei System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
bei System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
bei System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
bei System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ToolStrip.WndProc(Message& m)
bei System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Configuration dump:

Environment

Windows 10 x64

Status

Assignee

Unassigned

Reporter

Tobias Schramm

Affects versions

1.2.10

Components

None

Priority

Major