无法找到ArgumentException的根本原因

问题描述 投票:0回答:1

我正在调查应用程序中大量ArgumentException的原因(我怀疑它是内存碎片/内存不足异常的主要原因)。问题是我无法找到此异常的来源。

我有问题服务的内存转储,但我只能看到它发生在其中一个线程上,它与反射的东西有关,除了它似乎我找不到异常的原因。

ArgumentException详细信息:

Exception type:   System.ArgumentException
Message:          Missing parameter does not have a default value.
InnerException:   <none>
StackTrace (generated):
    SP       IP       Function
    0347D2F0 72B006F2 mscorlib_ni!System.Reflection.MethodBase.CheckArguments(System.Object[], System.Reflection.Binder, System.Reflection.BindingFlags, System.Globalization.CultureInfo, System.Signature)+0xc27c02
    0347D328 71EC0EDB mscorlib_ni!System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)+0x9b
    0347D35C 71EC0DD7 mscorlib_ni!System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)+0x37
    0347D390 71EC0D8E mscorlib_ni!System.Reflection.RuntimePropertyInfo.GetValue(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)+0x3e

StackTraceString: <none>
HResult: 80070057

~#s; !clrstack的输出:

OS Thread Id: 0x524 (1)
Child SP       IP Call Site
033fcf00 7726a8fc [HelperMethodFrame: 033fcf00] 
033fcfb0 72b006f2 System.Reflection.MethodBase.CheckArguments(System.Object[], System.Reflection.Binder, System.Reflection.BindingFlags, System.Globalization.CultureInfo, System.Signature)
033fcfe8 71ec0edb System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
033fd01c 71ec0dd7 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
033fd050 71ec0d8e System.Reflection.RuntimePropertyInfo.GetValue(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
033fda64 730eebe6 [DebuggerU2MCatchHandlerFrame: 033fda64] 
033fda34 730eebe6 [GCFrame: 033fda34] 
033fda18 730eebe6 [GCFrame: 033fda18] 

如何找出此异常的来源?它看起来像是缺少堆栈跟踪的一部分。

c# .net windbg sos
1个回答
2
投票

根据Microsoft文档,当以下任一情况属实时,PropertyInfo.GetValue()方法抛出ArgumentException

“索引数组不包含所需的参数类型。

-要么-

找不到该物业的入口通道。“

我会在源代码中查找调用GetValue()的任何调用并检查传递给它们的参数。上面列出的两种情景之一可能是罪魁祸首。

© www.soinside.com 2019 - 2024. All rights reserved.