.NET 3.5-Stackframe的getmethod返回以未知字符为前缀的属性名称 [英] .NET 3.5 - Stackframe's getmethod returns a property name prepended with unknown characters
问题描述
问题:StackFrame.GetMethod()
返回以未知字符为前缀的属性名称( myProperty返回为
__ XY_myProperty)
ISSUE: StackFrame.GetMethod()
returns a property name prepended with unknown characters (myProperty returned as
__XY_myProperty)
最近,我们在现有类中添加了一个属性.此类在ASP.NET中使用.此类中的每个属性都调用一个自定义的securitycheck函数,该函数使用stacktrace来获取被调用方的方法名称,以基于该名称执行操作.
Recently we have added a property to an existing class. This class is used in ASP.NET. Every property in this class calls a custom securitycheck function that uses stacktrace to get the method name of the callee to perform actions based on that name.
问题是,在运行时,StackFrame返回此新添加的属性名称( myProperty),并带有未知字符( __ XY_myProperty).这仅在生产机器上发生.我们无法复制 在任何其他具有类似设置的计算机上.
The issue is, StackFrame returns this newly added property name (myProperty) prepended with unknown characters (__XY_myProperty) during the runtime. This happens only on a production machine. We couldn't reproduce in any other machines that have similar settings.
以下是代码示例:
// comments public returntype myProperty { get { security.checkSecurity(); return returntype(); } set { security.checkSecurity(); if (value == null) { Row["abc"] = anothervale; } else { Row["xyz"] = value; } } } // comment
我们尝试的是: 这些都没有解决问题. 服务器信息: Get和Set都是方法,即使您在查看代码时都看不到它们是方法,它们遵循方法. Get's and Set's are methods, even though you don't see the fact that they're methods when looking at the code, they're complied down to methods. 这篇关于.NET 3.5-Stackframe的getmethod返回以未知字符为前缀的属性名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!StackFrame.GetMethod()
调用返回
myProperty 方法名称为:
__ XY_myProperty. StackFrame.GetMethod()
call in security.checkSecurity()
returns
myProperty method name as:
__XY_myProperty.(StackFrame.GetMethod()
调用not shown in the above example.)
推荐答案