Skip to main content
.NET Framework Class Library
PathTooLongException Class

The exception that is thrown when a path or file name is longer than the system-defined maximum length.

Inheritance Hierarchy
SystemObject
   SystemException
     SystemSystemException
       System.IOIOException
        System.IOPathTooLongException

Namespace:   System.IO
Assembly:  mscorlib (in mscorlib.dll)
Syntax
<[%$TOPIC/0za1eh22_en-us_VS_110_2_0_0_0_0%]> _
<[%$TOPIC/0za1eh22_en-us_VS_110_2_0_0_0_1%](True)> _
Public Class PathTooLongException _
	Inherits [%$TOPIC/0za1eh22_en-us_VS_110_2_0_0_0_2%]
[[%$TOPIC/0za1eh22_en-us_VS_110_2_0_1_0_0%]]
[[%$TOPIC/0za1eh22_en-us_VS_110_2_0_1_0_1%](true)]
public class PathTooLongException : [%$TOPIC/0za1eh22_en-us_VS_110_2_0_1_0_2%]
[[%$TOPIC/0za1eh22_en-us_VS_110_2_0_2_0_0%]]
[[%$TOPIC/0za1eh22_en-us_VS_110_2_0_2_0_1%](true)]
public ref class PathTooLongException : public [%$TOPIC/0za1eh22_en-us_VS_110_2_0_2_0_2%]
[<[%$TOPIC/0za1eh22_en-us_VS_110_2_0_3_0_0%]>]
[<[%$TOPIC/0za1eh22_en-us_VS_110_2_0_3_0_1%](true)>]
type PathTooLongException =  
    class 
        inherit [%$TOPIC/0za1eh22_en-us_VS_110_2_0_3_0_2%] 
    end
public class PathTooLongException extends [%$TOPIC/0za1eh22_en-us_VS_110_2_0_4_0_0%]

The PathTooLongException type exposes the following members.

Constructors
  NameDescription
Public method Supported by the XNA Framework PathTooLongExceptionInitializes a new instance of the PathTooLongException class with its HRESULT set to COR_E_PATHTOOLONG.
Public method Supported by the XNA Framework PathTooLongException(String)Initializes a new instance of the PathTooLongException class with its message string set to message and its HRESULT set to COR_E_PATHTOOLONG.
Protected method PathTooLongException(SerializationInfo, StreamingContext)Initializes a new instance of the PathTooLongException class with the specified serialization and context information.
Public method PathTooLongException(String, Exception)Initializes a new instance of the PathTooLongException class with a specified error message and a reference to the inner exception that is the cause of this exception.
Top
Properties
  NameDescription
Public property DataGets a collection of key/value pairs that provide additional user-defined information about the exception. (Inherited from Exception.)
Public property HelpLinkGets or sets a link to the help file associated with this exception. (Inherited from Exception.)
Public property Supported by the XNA Framework HResultGets or sets HRESULT, a coded numerical value that is assigned to a specific exception. (Inherited from Exception.)
Public property Supported by the XNA Framework InnerExceptionGets the Exception instance that caused the current exception. (Inherited from Exception.)
Public property Supported by the XNA Framework MessageGets a message that describes the current exception. (Inherited from Exception.)
Public property SourceGets or sets the name of the application or the object that causes the error. (Inherited from Exception.)
Public property Supported by the XNA Framework StackTraceGets a string representation of the immediate frames on the call stack. (Inherited from Exception.)
Public property TargetSiteGets the method that throws the current exception. (Inherited from Exception.)
Top
Methods
  NameDescription
Public method Supported by the XNA Framework Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Supported by the XNA Framework FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method Supported by the XNA Framework GetBaseExceptionWhen overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions. (Inherited from Exception.)
Public method Supported by the XNA Framework GetHashCodeServes as the default hash function. (Inherited from Object.)
Public method GetObjectDataWhen overridden in a derived class, sets the SerializationInfo with information about the exception. (Inherited from Exception.)
Public method Supported by the XNA Framework GetTypeGets the runtime type of the current instance. (Inherited from Exception.)

In XNA Framework 3.0, this member is inherited from Object GetType.
Protected method Supported by the XNA Framework MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public method Supported by the XNA Framework ToStringCreates and returns a string representation of the current exception. (Inherited from Exception.)
Top
Events
  NameDescription
Protected event SerializeObjectStateOccurs when an exception is serialized to create an exception state object that contains serialized data about the exception. (Inherited from Exception.)
Top
Remarks

PathTooLongException uses the HRESULT COR_E_PATHTOOLONG, which has the value 0x800700CE.

If your code does not have PathDiscovery permission, the error message for this exception may contain only file or directory names instead of full paths.

Full paths must not exceed 260 characters to maintain compatibility with Windows operating systems. For more information about this restriction, see the entry Long Paths in .NET in the BCL Team blog.

NoteNote

This exception is not included in the .NET for Windows Store apps or the Portable Class Library, but it is thrown by some members that are. To catch the exception in that case, write a catch statement for IOException instead.

Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.