Click here to Skip to main content
15,910,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Traget of an invocation arises. then i findout particular error using innerException.

it shows like this

C#
An exception of type 'System.IO.PathTooLongException' occurred in mscorlib.dll but was not handled in user code

Additional information: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.


pls help to solve this expection

What I have tried:

Stack Trace:

at System.IO.PathHelper.GetFullPathName()
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Softcooks.Utilities.Conversion.StringToFile(String value, String fileName, Boolean append)
at Softcooks.ExceptionExtension.LogErrorToFile(Exception exception, String fileName)
at Adinn.Adways.App.Start()
at Adinn.Adways.AdwaysApp.<initevents>b__0(Object sender, StartupEventArgs args)
at System.Windows.Application.OnStartup(StartupEventArgs e)
at System.Windows.Application.<.ctor>b__1(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Posted
Comments
Sascha Lefèvre 17-Feb-16 5:26am    
And how long is your path and file name?

The error message is pretty self explanatory:
An exception of type 'System.IO.PathTooLongException' occurred in mscorlib.dll but was not handled in user code
 
Additional information: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

So use the debugger, find out exactly what your file and path names are. Then find a way to use shorter ones!
 
Share this answer
 
Please at least google before posting:

.NET 2.0 Workaround for PathTooLongException[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900