在Visual Studio 2008中调试lambda表达式

时间:2022-01-16 02:56:24

Do you know a Visual Studio 2008 Addon, which allows the debugging of Lambda expressions (in the Watch window)?

您是否了解Visual Studio 2008 Addon,它允许调试Lambda表达式(在Watch窗口中)?

2 个解决方案

#1


It does not work for the same reason Edit-and-Continue does not work with methods with lambda expressions.

由于编辑和继续不适用于具有lambda表达式的方法,因此它不起作用。

This is due to the fact that while it is easy to change the IL of a method at runtime (see MethodRental for more info), changing the metadata of an assembly (which creating a closure requires) is impossible without reloading it.

这是因为尽管在运行时很容易更改方法的IL(有关更多信息,请参阅MethodRental),但如果不重新加载,则无法更改程序集的元数据(创建闭包需要)。

If C# had absolutely no side effects, this would be theoretically possible.

如果C#绝对没有副作用,理论上这是可能的。

#2


Here is something I read recently, it might be useful for you.

这是我最近阅读的内容,它可能对您有用。

You can also try VS2008 Expression Tree Visualizer or code your own. More information here

您也可以尝试VS2008 Expression Tree Visualizer或自己编写代码。更多信息在这里

#1


It does not work for the same reason Edit-and-Continue does not work with methods with lambda expressions.

由于编辑和继续不适用于具有lambda表达式的方法,因此它不起作用。

This is due to the fact that while it is easy to change the IL of a method at runtime (see MethodRental for more info), changing the metadata of an assembly (which creating a closure requires) is impossible without reloading it.

这是因为尽管在运行时很容易更改方法的IL(有关更多信息,请参阅MethodRental),但如果不重新加载,则无法更改程序集的元数据(创建闭包需要)。

If C# had absolutely no side effects, this would be theoretically possible.

如果C#绝对没有副作用,理论上这是可能的。

#2


Here is something I read recently, it might be useful for you.

这是我最近阅读的内容,它可能对您有用。

You can also try VS2008 Expression Tree Visualizer or code your own. More information here

您也可以尝试VS2008 Expression Tree Visualizer或自己编写代码。更多信息在这里