简体   繁体   English

如果名称空间与路径不匹配,则无法打开从其他表单继承的表单

[英]Form inheriting from another form will not open if the namespace does not match the path

I have an issue where I have a form inherited from a base control within my companies base Framework. 我有一个问题,其中有一个从公司基本框架中的基本控件继承的表单。

The base control in this is case called PlugInBase and is inherited from the standard System.UserControl . 在这种情况下,基本控件称为PlugInBase ,它继承自标准System.UserControl The namespace has to be fixed and does not match the path of the assembly. namespace必须是固定的,并且与程序集的路径不匹配。 The namespace is namespace Omitec.ThreeG.Runtime.Portal.PlugIns but the path is Omitec.ThreeG.Runtime.Portal.WindowsNative.PlugInBase . namespacenamespace Omitec.ThreeG.Runtime.Portal.PlugIns namespace namespace Omitec.ThreeG.Runtime.Portal.PlugIns但路径是Omitec.ThreeG.Runtime.Portal.WindowsNative.PlugInBase

If I try to open the form based on PlugInBase I get the standard Exception screen saying that the designer could not be shown as Omitec.ThreeG.Runtime.Portal.PlugInBase could not be loaded. 如果我尝试打开基于PlugInBase的表单, PlugInBase看到标准的“ Exception屏幕,显示无法将设计器显示为Omitec.ThreeG.Runtime.Portal.PlugInBase

Yet if I change the namespace in PlugInBase to match the path it opens no bother. 但是,如果我更改PlugInBasenamespace以匹配路径,则不会打扰。

The other weird thing is only some of the engineers in our office have this error. 另一个奇怪的事情是,我们办公室中只有一些工程师有此错误。 Other's do not. 别人没有。

After further investigation it's definitely an issue with the inherited controls namespace not matching the file path. 经过进一步调查,这肯定是继承的控件名称空间与文件路径不匹配的问题。

Is there some setting that strictly enforces the lookup of the namespace? 是否存在一些可以严格执行名称空间查找的设置? As I mentioned earlier some of the developers in the office do not have this issue with the exact same section of code. 正如我之前提到的,办公室中的某些开发人员在完全相同的代码部分中没有此问题。 that

As the framework is shared code I can not change the namespace from the standard. 由于框架是共享代码,因此我无法从标准更改namespace

This has been driving me mad for a while now. 这已经让我发疯了一段时间。 Any ideas? 有任何想法吗?

Visual Studio does this on occasion. Visual Studio有时会这样做。

Keep in mind that the designer does actually run the form's constructor to generate the designer. 请记住,设计器实际上确实在运行表单的构造函数以生成设计器。 If there is something in there that may throw this exception it could be your cause. 如果那里有东西可能引发此异常,则可能是您的原因。

Since the program is not actually running there is room for design time errors. 由于该程序实际上并未运行,因此存在设计时错误的空间。

If that is not the problem, the other way i have fixed it is to close all open designers. 如果那不是问题,那么我已解决的另一种方法是关闭所有开放的设计师。 Clean Solution, Build, then open the designer again. 清洁解决方案,构建,然后再次打开设计器。 Sometimes i have to add an additional step of closing visual studio if it has been open for a while. 如果它已经打开了一段时间,有时我必须添加关闭Visual Studio的其他步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM