本文介绍了.NET 3.5-Stackframe的getmethod返回以未知字符为前缀的属性名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题: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

>中的

StackFrame.GetMethod()调用返回 myProperty 方法名称: __ XY_myProperty.

StackFrame.GetMethod() call in security.checkSecurity() returnsmyProperty method name as:__XY_myProperty.

(StackFrame.GetMethod()调用not shown in the above example.)

我们尝试的是:

  1. 清除的ASP.NET缓存
  2. 比较的.NET补丁
  3. 重新启动服务器

这些都没有解决问题.

服务器信息:

  • Windows 2003
  • 在VMWare上运行(JIT在VMWare上的优化是否有所不同?)
  • IIS 6
  • NET 3.5
  • ASP在发布模式下构建的.NET项目
  • 在调试模式下编译的DLL可以使stacktrace正常运行

推荐答案


这篇关于.NET 3.5-Stackframe的getmethod返回以未知字符为前缀的属性名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 20:47