如何使用Visual Studio调试器的汇编名称限定.NET类型,以便在使用含糊的类型时消除歧义? [英] How can I qualify a .NET type with assembly name for Visual Studio debugger to disambiguate while using an ambiguous type?

查看:121
本文介绍了如何使用Visual Studio调试器的汇编名称限定.NET类型,以便在使用含糊的类型时消除歧义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS调试器的立即窗口来调用在两个不同程序集中定义的不明确类型的类的静态API。

I am using the VS debuggers 'Immediate Window' to call a static API on a class which is an ambiguous type defined in 2 different assemblies.

调用失败使用以下消息:
blah.dll foo > bar.dll

The call fails with the following message: The type foo exists in both blah.dll and bar.dll

这个消息是有道理的,因为确实如此。我的问题是如何在调试器中解决这个问题,以指定要使用哪个程序集来绑定这个类型?

This message makes sense since this is indeed the case. My question is how can I work around this in the debugger to specify which assembly I want to be used for binding this type?

有没有办法限定一个类型在...中定义的程序集名称?

Is there a way to qualify a type with the assembly name that it is defined in?

感谢
Bhavin。

Thanks Bhavin.

推荐答案

听起来你有两种类型的名称和命名空间相同,但是在不同的程序集中?如果是这种情况,不幸的是,在即时窗口中无法消除这个呼叫。立即窗口将这两种类型视为范围,因为程序集名称不能作为C#或VB.Net中的转换语法的一部分,因此无法消除这些类型的歧义。

It sounds like you have two types which have the same name and namespace but live in different assemblies? If that is the case, unfortunately there is no way to disambiguate this call in the immediate window. The immediate window considers both of these types to be in scope and since assembly name cannot be a part of the cast syntax in C# or VB.Net there is no way to disambiguate these types.

您唯一的选择是创建一个与其中一个或另一个绑定的替代调试API。然后在调试会话期间调用它。

The only option you have is to create an alternate debug only API which binds to one or the other. Then call this during the debugging session.

这篇关于如何使用Visual Studio调试器的汇编名称限定.NET类型,以便在使用含糊的类型时消除歧义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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