调用目标抛出了C#异常 [英] C# exception has been thrown by the target of an invocation

查看:252
本文介绍了调用目标抛出了C#异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

T 调用的raget出现了。然后我发现使用innerException特定错误。



它显示如下



Traget of an invocation arises. then i findout particular error using innerException.

it shows like this

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.





请帮忙解决这个问题



我尝试了什么:



Stack Trace:



在System。 System.IO.Path.NormalizePath上的IO.PathHelper.GetFullPathName()

(String path,Boolean fullCheck,Int32 maxPathLength,Boolean expandShortPaths)
System.IO.Path上的
.NormalizePath(字符串路径,布尔fullCheck,的Int32 maxPathLength)

在System.IO.FileStream.Init(字符串路径,模式的FileMode,FileAccess的访问,的Int32权利,布尔useRights,文件共享份额,缓冲区大小的Int32, FileOptions选项,SECURITY_ATTRIBUTES secAttrs,字符串MSGPATH,布尔bFromProxy,布尔useLongPath,布尔checkHost)在System.IO.FileStream..ctor

(字符串路径,模式的FileMode,FileAccess的ACC ess)

在Softcooks.Utilities.Conversion.StringToFile(String value,String fileName,Boolean append)

在Softcooks.ExceptionExtension.LogErrorToFile(异常异常,String fileName)<在Adinn.Adways.App.Start()

Adinn.Adways.AdwaysApp。< initevents> b__0(对象发送者,StartupEventArgs args)
$ b System.Windows.Application.OnStartup(StartupEventArgs e)上的$ b
System.Windows.Application上的
。< .ctor> b__1(未使用的对象)

在System。 Windows.Threading.ExceptionWrapper.InternalRealCall(代表回调,对象指定参数时,的Int32 numArgs)

。在MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象指定参数时,的Int32 numArgs,代表catchHandler )



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)

推荐答案

错误信息非常自我解释:

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!


请在发布之前至少谷歌:



.NET 2.0 PathTooLongException的解决方法 [ ^ ]
Please at least google before posting:

.NET 2.0 Workaround for PathTooLongException[^]


这篇关于调用目标抛出了C#异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆