Конструктор windows forms ошибка

After some work on form in Visual Studio 2015, form designer suddenly became unavailable.

Symptoms:

  • item View Designer is missing from context menu of form code class in Solution Explorer
  • usual keyboard shortcut cannot be used to switch to the designer
  • .Designer and .resx files are still in place and correctly shown as subtree items of form code class
  • .Designer and .resx files look healthy from inside, they have every mandatory part
  • Visual Studio reports 0 errors
  • only one form is affected, other can be open in the designer normally

Why the Visual Studio is not evaluating form files as valid, not showing Designer view?

asked Aug 8, 2015 at 8:40

miroxlav's user avatar

Fix: In source code of the form, manually move any classes below the class which defines the form. The form class must be the first class definition encountered when reading the source file from top to bottom.

Details:

I accidentally locked myself out, with error message written behind the locked door.

Issue: During the work, I temporarily added a trivial helper class to the beginning of the form code file. If I had the designer open that time, I could have seen the following error:

The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.

The catch is, the error shows only in the designer. If you have only code window open at the moment, you won’t spot the error – and worse, you are no more allowed to enter the designer view to discover it.

So a case can happen, when Visual Studio gives no clue – the only help is qualified guess and trial.

answered Aug 8, 2015 at 8:40

miroxlav's user avatar

miroxlavmiroxlav

11.8k5 gold badges58 silver badges99 bronze badges

4

in case anyone else needs a different fix, i had the same issue but it was with telerik reports.

not sure why or how, but my issue was a corrupted project file. The subtype element was missing for the reports. This element tells visual studio to use a designer template to open the file, instead of code view.

the subtype depends on what type of control it is. For a windows form the subtype would be Form

unload the project -> right click -> edit «.csproj»

so i changed this (in the project file):

<Compile Include="Report1.cs" />
<Compile Include="Report1.Designer.cs">
  <DependentUpon>Report1.cs</DependentUpon>
</Compile>

to this:

<Compile Include="Report1.cs">
  <SubType>Component</SubType> <!-- if winform, this would be Form instead -->
</Compile>
<Compile Include="Report1.Designer.cs">
  <DependentUpon>Report1.cs</DependentUpon>
</Compile>

reload the project.

answered Oct 12, 2020 at 1:01

Heriberto Lugo's user avatar

Just add existing designer of the form from the directory to solve the problem.
After adding the existing file in visual studio the context menu for ‘view designer’ is showing.

visual studio view designer not showing case

miroxlav's user avatar

miroxlav

11.8k5 gold badges58 silver badges99 bronze badges

answered Dec 2, 2021 at 11:13

Arjun's user avatar

ArjunArjun

11 bronze badge

  • Remove From My Forums
  • Вопрос

  • При создании Windows Forms не удается открыть верно Конструктор. Сразу при создании проекта выводится следующее сообщение:

    _________________________________________________________________________________

    Чтобы избежать возможной потери данных перед загрузкой конструктора, необходимо исправить следующие ошибки:

    Данные, необходимые для завершения этой операции еще не доступны. (Исключение из HRESULT: 0x8000000A)

     
    Экземпляры ошибки (1)
    в Microsoft.VisualStudio.Designer.Interfaces.IVSMDCodeDomProvider.get_CodeDomProvider()
    в Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_Provider()
    в Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
    в Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    в Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
     
    Показать информацию по данной ошибке
    Не удалось обнаружить раздел справки, связанный с этой ошибкой.
    Проверить список ошибок времени разработки Windows Forms
     
    Сообщения об этой ошибке в форуме
    Поиск сообщений о данной ошибке в форумах MSDN
     

    _________________________________________________________________________________

    Даже после запуска, когда окно «MyForm» открывается, сообщение об ошибки не исчезает, соответственно, никакие правки окна я не могу сделать. 

    Смотрела на разных ресурсах, в том числе на этом, но ответа на свой вопрос так и не нашла.

    Впервые занялась интерфейсом. Пока мало, что понятно. Объясните, пожалуйста, как справиться с описанной выше проблемой.

    • Изменено

      10 сентября 2017 г. 13:59

Ответы

  • Добрый День.

    Дело скорее всего в не_корректности (повреждении) шаблона на основе которого вы создаете проект.

    Либо проблема в коде дизайнера формы, см. скрин


    Я не волшебник, я только учусь
    MCP CCNA. Если Вам помог чей-либо ответ, пожалуйста, не забывайте жать на кнопку «Пометить как ответ» или проголосовать «полезное сообщение». Мнения, высказанные здесь, являются отражением моих личных взглядов,
    а не позиции работодателя. Вся информация предоставляется как есть без каких-либо гарантий.
    Блог IT Инженера,
    Twitter.

При создании приложений Windows Forms на C# в Visual Studio может возникнуть ситуация, когда конструктор окна (формы) перестает работать. Это может произойти по разным причинам, но существует несколько простых решений, чтобы исправить это.

Перезапуск Visual Studio

Первым шагом, который вы можете предпринять, это перезапустить Visual Studio. Некоторые временные ошибки могут возникнуть в связи с недостаточной памятью или неправильной загрузкой компонентов Visual Studio.

Удаление элемента из окна

Если перезапуск не привел к успеху, вы можете попробовать удалить некоторые элементы из окна (формы). Иногда некоторые элементы могут вызывать конфликты, которые приводят к неработающему конструктору окна. Попробуйте удалять элементы поочередно, каждый раз проверяя конструктор окна.

Проверьте код

Если все еще не удается исправить проблему, возможно, проблема заключается в коде. Откройте файл формы (form.cs) и проверьте, есть ли там какие-то ошибки. Иногда неверно написанный код может вызвать проблемы с конструктором окна.

Проверьте свойства элементов

Если вы добавили новый элемент на форму, убедитесь, что его свойства заданы правильно. Некоторые свойства элементов могут привести к ошибке в конструкторе окна, если они заданы неверно.

Отключите дополнения

Если у вас установлены какие-либо расширения для Visual Studio, попробуйте отключить их. Некоторые расширения могут вызывать ошибки в работе конструктора окна. Отключение расширений поможет выяснить, вызывает ли какое-то конкретное расширение проблемы.

Обновите Visual Studio

Если все вышеперечисленные шаги не помогли исправить проблемы, попробуйте обновить Visual Studio до последней версии. В новой версии Visual Studio могут быть исправлены ошибки, которые вызывают проблемы в работе конструктора окна.

Если все остальное не привело к успеху, вы можете создать новое окно (форму) и скопировать все элементы из старого окна. Это может занять некоторое время, но это должно сработать.

Теперь вы знаете, как исправить проблему с неработающим конструктором окна в Windows Visual Studio C# Windows Forms. Надеемся, что одно из предложенных выше решений поможет вам решить проблему.

Установлена Visual Studio 2015.
Создаю CLRПустой проект CLR
Далее в свойствах выставляю сразу подсистему — Windows, и точку входа — Main.
После этого ДобавитьСоздать элементUIWindows Form. Появляются два файла, заголовочный и cpp.
Сразу же при создании появляется ошибка конструктора
введите сюда описание изображения

Ладно, закрываю. Кидаю код в MyForm.cpp:

#include "MyForm.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

[STAThreadAttribute]
int Main(array<System::String ^> ^args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
    project9::MyForm form;
    Application::Run(%form);

    return 0;
}

Сохраняю. Запускаю проект, форма появляется.

Опять хочу открыть MyForm.h через конструктор, получаю в ответ
введите сюда описание изображения

Окей. Открываю MyForm.h просто через редактор, открыло код. Хорошо.
Жмякаю опять открыть через конструктор, получаю в ответ
введите сюда описание изображения

Что происходит с этой студией… Как это исправить?
Я просто хотел открыть форму в конструкторе

Fix: In source code of the form, manually move any classes below the class which defines the form. The form class must be the first class definition encountered when reading the source file from top to bottom.

Details:

I accidentally locked myself out, with error message written behind the locked door.

Issue: During the work, I temporarily added a trivial helper class to the beginning of the form code file. If I had the designer open that time, I could have seen the following error:

The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.

The catch is, the error shows only in the designer. If you have only code window open at the moment, you won’t spot the error – and worse, you are no more allowed to enter the designer view to discover it.

So a case can happen, when Visual Studio gives no clue – the only help is qualified guess and trial.

Здраствуйте, я скачал чистую visual studio для выполнения лабораторной работы. Мне нужно было создать определенный тип проекта. Установил нужные компоненты. Дальше хотел добавить windows forms, но после создания в конструкторе форм
возникает ошибка. Я попробовал поставить еще другие модули из C++, вдруг каких-то не хватает, но все равно выдает ошибку.

Скриншот пока вставить не удается, поэтому скину текст:

Данные, необходимые для завершения этой операции еще не доступны. (Исключение из HRESULT: 0x8000000A)

Может если еще надо стек вызовов:

в Microsoft.VisualStudio.Designer.Interfaces.IVSMDCodeDomProvider.get_CodeDomProvider()
в Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_Provider()
в Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
в Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
в Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

We have the following shared component:

public class OurServiceBase : System.ServiceProcess.ServiceBase

This class has functionality we want in all our downstream services, such as standardized execution scheduling and logging functionality.

In a new project, I add the following:

public class MyService : System.ServiceProcess.ServiceBase

In the Windows Designer, the class shows properly.

When I change the service to derive from OurServiceBase

public class MyService : OurSharedLibrary.OurServiceBase

The designer stops working:

Error screenshot

The full error is:
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: EmailProcessor — The base class ‘OurSharedLibrary.CienaServiceBase’ could not be loaded. Ensure the assembly has been referenced and that all projects have been built.

The proper assemblies are referenced, the project builds. I don’t understand why the designer is flipping out over this since my service ultimately does derive from a designable class.

Any suggestions would be most welcome.

Bit more information — the call stack from the designer when it renders the error about not being able to design the derived service:

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) 

7/19/2011 2:34PM EDT New discovery.

Class «OurServiceBase» exists in a separate project (usually referenced as a DLL only). On a whim, I copied the base class file into my project, built, and opened the designer. It worked! When I removed the base class file again and returned to the external DLL reference, the designer broke again.

We have the following shared component:

public class OurServiceBase : System.ServiceProcess.ServiceBase

This class has functionality we want in all our downstream services, such as standardized execution scheduling and logging functionality.

In a new project, I add the following:

public class MyService : System.ServiceProcess.ServiceBase

In the Windows Designer, the class shows properly.

When I change the service to derive from OurServiceBase

public class MyService : OurSharedLibrary.OurServiceBase

The designer stops working:

Error screenshot

The full error is:
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: EmailProcessor — The base class ‘OurSharedLibrary.CienaServiceBase’ could not be loaded. Ensure the assembly has been referenced and that all projects have been built.

The proper assemblies are referenced, the project builds. I don’t understand why the designer is flipping out over this since my service ultimately does derive from a designable class.

Any suggestions would be most welcome.

Bit more information — the call stack from the designer when it renders the error about not being able to design the derived service:

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) 

7/19/2011 2:34PM EDT New discovery.

Class «OurServiceBase» exists in a separate project (usually referenced as a DLL only). On a whim, I copied the base class file into my project, built, and opened the designer. It worked! When I removed the base class file again and returned to the external DLL reference, the designer broke again.

Установлена Visual Studio 2015.
Создаю CLRПустой проект CLR
Далее в свойствах выставляю сразу подсистему — Windows, и точку входа — Main.
После этого ДобавитьСоздать элементUIWindows Form. Появляются два файла, заголовочный и cpp.
Сразу же при создании появляется ошибка конструктора
введите сюда описание изображения

Ладно, закрываю. Кидаю код в MyForm.cpp:

#include "MyForm.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

[STAThreadAttribute]
int Main(array<System::String ^> ^args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
    project9::MyForm form;
    Application::Run(%form);

    return 0;
}

Сохраняю. Запускаю проект, форма появляется.

Опять хочу открыть MyForm.h через конструктор, получаю в ответ
введите сюда описание изображения

Окей. Открываю MyForm.h просто через редактор, открыло код. Хорошо.
Жмякаю опять открыть через конструктор, получаю в ответ
введите сюда описание изображения

Что происходит с этой студией… Как это исправить?
Я просто хотел открыть форму в конструкторе

  • Hi Priyankak,

    It not an easy problem for answer, because there may be multiple possible reasons, I’ll try.

    By default, it’s better to code “InitializeComponent” only with its auto-generating mechanism, which means other initialization work is recommended to be written in Form’s constructor.

    Please refer to the following statement I found in “Windows Forms 2.0 Programming” which written by Chris Sells and Michael Weinhardt:

    InitializeComponent is Designer-generated, and consequently it’s a bad idea to put custom code into it because the Designer is likely to throw it away. However, if you’d like to add other controls or change anything set by the InitializeComponent method, you can do so from the constructor after the call to InitializeComponent:

    Code Snippet

    public Form1() {

       InitializeComponent();

    // Add custom initialization code here, after InitializeComponent

       // Adding a control

       Button anotherButton = new Button();

       this.Controls.Add(anotherButton);

       // Changing a property to something not known at design-time

       this.Text = DateTime.Now.ToString();

    }

    And you said that this problem occurred when the project is converted from VS2005 to VS2008, then you can also try the following troubleshooting steps to see whether it’s the problem caused by Visual Studio:

    1.       Have you applied the latest service pack? If not, please apply the service pack.

    2.       If we create a new project, do we have the problem? Sometimes corrupted project settings can cause problems. These are project specific.

    3.       If we reboot the operating system to safe mode, do we have the problem? This can help to isolate whether any other applications are interfering with Visual Studio. Note that some features (like IIS) are not available under safe mode. Please check whether this can apply or not. In addition to safe mode, we can also suggest “clean boot”:

    http://support.microsoft.com/kb/310353

    4.       If we create a new user account, do we have the problem? This can help to isolate user profile corruption related causes.

    5.       If we disable Add-ns (e.g. “Tools” | “Add-in Manager”) and run “devenv.exe /safemode”, do we still have the problem? This can eliminate the possibility that third party Add-ins are causing problems.

    For more discussion about this problem, please refer to the following thread:

    Designer errors

    And here are two useful articles found by community members:

    For how to debugging Visual Studio’s source code, please refer to: Configuring Visual Studio to Debug .NET Framework Source Code

    For how to debug Forms at design time, please refer to: Walkthrough: Debugging Custom Windows Forms Controls at Design Time

    Hope it helps.

    Thanks.

    Best wishes,

    Jun Wang

  • Hi Priyankak,

    It not an easy problem for answer, because there may be multiple possible reasons, I’ll try.

    By default, it’s better to code “InitializeComponent” only with its auto-generating mechanism, which means other initialization work is recommended to be written in Form’s constructor.

    Please refer to the following statement I found in “Windows Forms 2.0 Programming” which written by Chris Sells and Michael Weinhardt:

    InitializeComponent is Designer-generated, and consequently it’s a bad idea to put custom code into it because the Designer is likely to throw it away. However, if you’d like to add other controls or change anything set by the InitializeComponent method, you can do so from the constructor after the call to InitializeComponent:

    Code Snippet

    public Form1() {

       InitializeComponent();

    // Add custom initialization code here, after InitializeComponent

       // Adding a control

       Button anotherButton = new Button();

       this.Controls.Add(anotherButton);

       // Changing a property to something not known at design-time

       this.Text = DateTime.Now.ToString();

    }

    And you said that this problem occurred when the project is converted from VS2005 to VS2008, then you can also try the following troubleshooting steps to see whether it’s the problem caused by Visual Studio:

    1.       Have you applied the latest service pack? If not, please apply the service pack.

    2.       If we create a new project, do we have the problem? Sometimes corrupted project settings can cause problems. These are project specific.

    3.       If we reboot the operating system to safe mode, do we have the problem? This can help to isolate whether any other applications are interfering with Visual Studio. Note that some features (like IIS) are not available under safe mode. Please check whether this can apply or not. In addition to safe mode, we can also suggest “clean boot”:

    http://support.microsoft.com/kb/310353

    4.       If we create a new user account, do we have the problem? This can help to isolate user profile corruption related causes.

    5.       If we disable Add-ns (e.g. “Tools” | “Add-in Manager”) and run “devenv.exe /safemode”, do we still have the problem? This can eliminate the possibility that third party Add-ins are causing problems.

    For more discussion about this problem, please refer to the following thread:

    Designer errors

    And here are two useful articles found by community members:

    For how to debugging Visual Studio’s source code, please refer to: Configuring Visual Studio to Debug .NET Framework Source Code

    For how to debug Forms at design time, please refer to: Walkthrough: Debugging Custom Windows Forms Controls at Design Time

    Hope it helps.

    Thanks.

    Best wishes,

    Jun Wang

  • Я использую VS2010, и если у меня есть форма, открытая в режиме конструктора и запускающая мое приложение, вкладка конструктора больше не будет показывать конструктор форм, но вместо этого будет отображаться ошибка (и она фиксируется только при перезапуске IDE) говоря:

    «Чтобы предотвратить возможную потерю данных перед загрузкой конструктора, следует устранить следующие ошибки:»

    1 Ошибка:

    «Дизайнер не может быть показан для этого файла, потому что ни один из классы внутри него могут быть разработаны. Дизайнер осмотрел следующие классы в файле: ##### — Базовый класС##### может не загружается. Убедитесь, что на сборке указаны ссылки и что все проекты были построены»

    Затем я показываю следующий стек вызовов:

    в System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(менеджер IDesignerSerializationManager)
    в System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(менеджер IDesignerSerializationManager)
    в Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    в System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(узел IDesignerLoaderHost)

    Любая помощь очень признательна, это действительно раздражает.

    Спасибо,

    Joel.

    Ответ 1

    Я получаю эту визуальную студийную ошибку тоже время от времени, и я глубоко игнорирую текст ошибки, вместо этого я делаю следующее:

    • Закройте вкладку «Дизайн»
    • Открывает режим разработки двойным щелчком в обозревателе решений или щелчком правой кнопкой мыши вкладку «Исходный код» и выберите «Просмотреть конструктор»
    • Вдруг все работает снова!

    Если вы не поможете, вам, возможно, придется сменить пулю 2 на:
    Закройте и перезапустите Visual Studio.

    Возможно, это может помочь вам.

    Ответ 2

    Я обычно закрываю визуальную форму, перестраиваю решение, щелкаю правой кнопкой мыши, затем выбираю «представление конструктора» в коде формы.

    Очень, очень раздражает. Я думаю вернуться к VS2008.

    Ответ 3

    Закройте форму. Очистите раствор. Перестройте решение. Повторно открыть форму. Работал для меня, когда ничего другого не было.

    Ответ 4

    Я могу избежать перезапуска VS, выполнив следующие

    • Добавить новый пользовательский элемент управления
    • Перетащите некоторые пользовательские элементы управления на него (если оно дает вам ошибку, снова создайте решение).
    • Восстановите свой контроль.

    В моем случае у меня есть проект winforms с несколькими настраиваемыми элементами управления, которые используются другими настраиваемыми элементами управления. Всякий раз, когда я открываю некоторые из этих настраиваемых элементов управления, я получаю ошибку «Базовый класс…». Добавление нового настраиваемого элемента управления, создание проекта, а затем добавление некоторых пользовательских элементов управления из моего проекта в новый настраиваемый элемент управления позволило мне открыть настраиваемые элементы управления, которые давали мне ошибку «Базовый класс…».

    ОБНОВЛЕНИЕ: Я думаю, что нашел проблему. Мои элементы управления не были правильно добавлены в файл csproj. В файле csproj файлы для частичных классов элементов/компонентов пользовательского интерфейса должны иметь атрибут «DependentUpon».

    E.x.:
    раньше:

    <Compile Include="WindowsFormsDataGridView.cs">
        <SubType>Component</SubType>
    </Compile>
    <Compile Include="WindowsFormsDataGridView.Designer.cs" />
    

    после

    <Compile Include="WindowsFormsDataGridView.cs">
        <SubType>Component</SubType>
    </Compile>
    <Compile Include="WindowsFormsDataGridView.Designer.cs">
        <DependentUpon>DataGridView.cs</DependentUpon>
    </Compile>
    

    Ответ 5

    У меня была такая же проблема, и я смог решить эту проблему, создав новый проект, а затем скомпилировав и запустив проект, а затем я импортировал все файлы и снова запускал проект, и автоматически он работал снова, ничего лишнего не делал.

    Ответ 6

    У меня была ситуация, когда пользовательский элемент управления, похоже, создавал ошибку (не уверен, почему), поэтому я удалил ссылки на пользовательский элемент управления из формы, и ошибка исчезла.

    Ответ 7

    Кажется, что после установки SP1 проблема ушла.

    Спасибо за вашу помощь всем.

    Ответ 8

    У меня была та же проблема с использованием элемента управления с помощью Generics

          MvpUserControl<Presenter,IViewMode> : UserControl
    

    что я делаю. Удалите ссылку и добавьте снова, очистите и перестройте решение. Надеюсь, это может быть полезно для кого-либо еще.

    Ответ 9

    У меня была такая же проблема с VS2010 SP1. Наконец, с помощью Центра обновления Windows я увидел некоторые обновления для Visual Studio и .Net, я их установил и больше не происходит.

    Ответ 10

    Старый пост, но для тех, кто может найти это…

    Просто вмешался в эту ошибку, и для меня это было относительно простое исправление.

    Установлено, что это может иметь какое-то отношение к именам ваших классов и переименовать проблематичный класс в более высокий порядок. Это алфавитный порядок, который он появляется в сборке (где A выше Z).

    Статья MSDN

    Удачи.

    Ответ 11

    Эта ошибка возникает, если класс Form не является первым классом в файле, например, если в начале файла есть вспомогательный класс.

    Чтобы решить эту проблему, переместите все остальные классы, кроме класса Form, в нижнюю часть файла.

    Ответ 12

    Не используйте код Form1.Designer.cs. Переместите свою логику в Form1.cs (нажмите F7 на вкладке Form1.cs [Дизайн]).

    Ответ 13

    «В файле проекта (.vcxproj) найдите запись для цели Рамочная версия. Например, если ваш проект предназначен для использования .NET Framework 4.5, найдите v4.5 в  элемент элемента.»

    (Microsoft)

    В моем случае «v4.5» не существовало, поэтому я добавляю его, и теперь все хорошо.

    Ответ 14

    Я попробовал чистое решение и пересобрать решение и работал на меня. Надеюсь, это поможет!

    При двойном клике на «Form1.cs» перестал открываться конструктор проекта. Переносить код в другой проект очень уж не хочется. Как решить проблему?

    5b8277f7ada98913718549.jpeg


    • Вопрос задан

    • 9352 просмотра

    Пригласить эксперта

    Попробуйте зайти во вкладку ВИД

    Смотрите ошибки конструктора, возможно изменили код конструктора, что угодно может быть. Конструктор частенько бывает в ступоре из-за разного кода или положения элементов. Для простых форм — он отличен, но когда надо что-то нестандартное или сложное, то лучше ручками писать. Имеет смысл создать новую форму и в неё ручками потихоньку перенести код конструктора старой формы и смотреть на каком этапе конструктор ломается.


    • Показать ещё
      Загружается…

    22 сент. 2023, в 03:45

    2000 руб./в час

    22 сент. 2023, в 01:22

    10000 руб./за проект

    22 сент. 2023, в 00:39

    30000 руб./за проект

    Минуточку внимания

    Понравилась статья? Поделить с друзьями:
  • Конструктивный праксис ошибки
  • Кондуктор обилетил всех пассажиров речевая ошибка
  • Коника минолта bizhub 185 ошибка c2558
  • Конструктивные ошибки это
  • Кондуктометр кац 037 ошибки