Модераторы: diadiavova, gambit
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Ошибка при создании формы, ошибка с COM 
:(
    Опции темы
orhor
Дата 27.10.2006, 18:48 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 5
Регистрация: 27.10.2006

Репутация: нет
Всего: нет




M
Exception
Тема была выделена отсюда.
Исходное сообщение было написано на английском, но, поскольку форум является русскоязычным, я перевёл его.


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

Каждый раз VS указывает на следующую часть Application.Designer.vb:

Код

    <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
    Protected Overrides Sub OnCreateMainForm()
        Me.MainForm = Global.AppName.Form1 ' <- здесь VS показывает ошибку
    End Sub


и после этого происходит ещё одна ошибка:
The CLR has been unable to transition from COM context 0x1b2258 to COM context 0x1b23c8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation......

Что странно: если я выбираю другую форму в качестве формы по умолчанию, всё проходит нормально. Я снова выбрал предыдущую (которую и хотел сделать стартовой), запустил приложение и всё было нормально. Но после нескольких запусков ошибка снова стала возникать.

Это сообщение отредактировал(а) Exception - 28.10.2006, 18:34
PM MAIL   Вверх
ivashkanet
Дата 27.10.2006, 21:24 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Кодю потиху
****


Профиль
Группа: Участник Клуба
Сообщений: 3684
Регистрация: 23.2.2006
Где: Гомель, Беларусь

Репутация: 5
Всего: 149



orhor, please give us the full VS project (compress it, click on a first green maple leaf here (with "ответить" word, then click on browse and attach the file). 
This code is added in each VB application by VS wizard. Therefore, we can’t understand the problem you have. 

P.S. 
Цитата(orhor @  27.10.2006,  18:48 Найти цитируемый пост)
Me.MainForm = Global.AppName.Form1 ' <-this is where VisualStudio shows smtg is wrong

This code is marked with DebuggerStepThroughAttribute so the debugger isn't stop at this place, I think.

P.P.S. Кроме того. Что это за понты писать на английском? Если ты попал на этот сайт, понял куда тебе писать  smile
P.P.P.S. Или это к нам стали приводить поисковики после изменения адресной строки  smile 

PM MAIL WWW ICQ   Вверх
orhor
Дата 27.10.2006, 23:29 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 5
Регистрация: 27.10.2006

Репутация: нет
Всего: нет



hi, thank you for your quick answer, i think i'm gonna write in english, even when I'm from Czech Republic - thats the reason I 'can' read po ruski smile

I can attach all the project, but it is all written in czech, including the controls and variables names so if you don't mind...

Now I'm a step closer to figuring out whats wrong: when I delete the dir with user.config file (I'm using My.Settings in my app) the prog runs OK, even when several settings are saved, the prog runs OK. So now Im investigating what settings are doing wrong.

I attach my project, if you need me to translate it to english just let me know.

Thank you

Присоединённый файл ( Кол-во скачиваний: 7 )
Присоединённый файл  PrejmenovavacFotek.zip 41,84 Kb
PM MAIL   Вверх
$tatic
Дата 28.10.2006, 17:15 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 651
Регистрация: 28.1.2005

Репутация: нет
Всего: 22



 smile Программисты всех стран соединяйтесь! Наш форум становится интернациональным. Это радует
PM MAIL   Вверх
Exception
Дата 28.10.2006, 18:40 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
****


Профиль
Группа: Участник Клуба
Сообщений: 4525
Регистрация: 26.12.2004

Репутация: 18
Всего: 186




M
Exception
Перевёл первое сообщение, как успею - переведу остальные.

Возвращаясь к теме, а может заработает, если заменить Form1 на New Form1() в коде того метода?
Returning to the topic, it seems to me your code will work if you replace Form1 with New Form1() in the code of that method.
PM   Вверх
orhor
Дата 28.10.2006, 21:10 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 5
Регистрация: 27.10.2006

Репутация: нет
Всего: нет



smile Программисты всех стран соединяйтесь! smile

Yeah I vote so!

It's very pleasant experience to be on a russian forum, even when I cannot join in with your language (maybe a bit later smile). Mybe I could try to write in my native language which is czech, its Slavonian too ... 

back to the topic:
have you meant this?
Код

Me.MainForm = New Form1()


This generates another error of the same desription but in the other place. Now it stops in the stav module at line
Код

Form1.DataGrid.Rows.Clear()


I cant see why it says that the form has referenced to itself by the name Form1 when it is in the module stav in the stav.vb file?

Díky za vaše nápady
Thanks for your ideas smile
PM MAIL   Вверх
Exception
Дата 28.10.2006, 22:04 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
****


Профиль
Группа: Участник Клуба
Сообщений: 4525
Регистрация: 26.12.2004

Репутация: 18
Всего: 186



Well, if I were you I would:
1. Set another form as startup and see if generated code changes and what exactly difference is (compare normal and error causing code).
2. If the way above wouldn't work for you then just create a new form, set it as the startup, ensure that it runs OK and then copy-paste all the controls and code from the original one to it to see what causes the error.

Это сообщение отредактировал(а) Exception - 28.10.2006, 22:06
PM   Вверх
orhor
Дата 28.10.2006, 22:54 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 5
Регистрация: 27.10.2006

Репутация: нет
Всего: нет



yes, the only thing that changes when I change the starting form is the line Me.MainForm = Global.AppName.Form1 to the corresponding form.

I thing the problem is somwhere  else. That behaviour I described above with the Settings. When I delete the user.congig file all is OK. But I cant see where do I use the settings in a wrong way. PLease could you focus on that? I cant determine which setting is doing wrong smile

Это сообщение отредактировал(а) orhor - 28.10.2006, 22:55
PM MAIL   Вверх
Exception
Дата 29.10.2006, 01:48 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
****


Профиль
Группа: Участник Клуба
Сообщений: 4525
Регистрация: 26.12.2004

Репутация: 18
Всего: 186



Seems like a settings problem. Why don't you just use classes from the System.Configuration namespace rather than trying to make all that visual stuff work? It is much more powerful and flexible mechanism - and it does not require any additional code to be generated. If you're new to it, you might want to MSDN/google for information on using ConfigurationManager class and others related. Though this model doesn't support scopes of settings different than the application scope (all of them are being stored in the app.config file naturally) I don't think this feature was really useful. Personally, I would rather use System.Configuration than that buggy My.Settings classes.

Это сообщение отредактировал(а) Exception - 29.10.2006, 01:54
PM   Вверх
ivashkanet
Дата 29.10.2006, 12:40 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Кодю потиху
****


Профиль
Группа: Участник Клуба
Сообщений: 3684
Регистрация: 23.2.2006
Где: Гомель, Беларусь

Репутация: 5
Всего: 149



Цитата(orhor @  27.10.2006,  23:29 Найти цитируемый пост)

 PrejmenovavacFotek.zip 41,84 Kb

It is really strange, but I haven't any compiling errors  smile 
I have started the app. It works OK.

I think the problem is a framework or VS problem. Try to reinstall the FW and VS.

If it doesn't solve the problem, you have to refuse using the VB class My. Yes, it is bad solvution but it is solution.

P.S. I hope the reinstalling will fix the problem you have.
PM MAIL WWW ICQ   Вверх
ivashkanet
Дата 29.10.2006, 13:04 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Кодю потиху
****


Профиль
Группа: Участник Клуба
Сообщений: 3684
Регистрация: 23.2.2006
Где: Гомель, Беларусь

Репутация: 5
Всего: 149



Ouhch, I have generated the exception (it appear in Release compiling mode)
Цитата

The CLR has been unable to transition from COM context 0x1b2480 to COM context 0x1b25f0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

But I don't understand how  smile At next times I didn't see the Exception.

Цитата
for 60 seconds

I think it isn't a setting's problem. It is a your code problem. 
Sometimes, some part of your code takes too much time (more then 60 sec). we need to find this part and do it more easy or insert Application.DoEvents inside it.

Добавлено @ 13:07 
orhor, it should be better Iа you used the english variables naming because it is too difficalt to andertsand you code  smile 
PM MAIL WWW ICQ   Вверх
orhor
Дата 29.10.2006, 14:23 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 5
Регистрация: 27.10.2006

Репутация: нет
Всего: нет



Цитата(Exception)

...Why don't you just use classes from the System.Configuration...

Thank you for your suggestion, I'll try.
I used to use VB6 years ago, now I'm trying to get back to VB.NET, so I have to learn a lot smile

Цитата(ivashkanet)

...but I haven't any compiling errors...

The way to generate the error is to run the app, it runs OK for the first time, to set all the settings needed, run the copying action, close the app and then rerun the app and voila - the error is here.

Detailed description of app:
The app should copy or move files from one location to another alowing to rename the files. Typical model: Move files from digital camera (they are named like P20566544.JPG) to your picture folder. 

The tabs:
Tab 1:
here you set the source folder, by clicking on Set default you set the path to be used the next time you run the app. If the default path is not set, the app remembers the path last used.
The check box in the middle sets if the files from the children folders will be copied/moved too. The radio buttons determine wether all the directories substructure will be copied, or the files from the source subfolders will be copied/moved to one destination folder.

Tab2:
Destination path. 'Set default' will remember the path to be used next time, otherwise the app remembers the path last used. The check box at the bottom determines whether to create the subfolder in the destination folder. The name of the subfolder can be generated automaticly according to the mask created. The mask is saved in the combobox. So in the next run yhe user dont need to set anything. the folder will be created automaticly...

Tab 3:
Action: Move  x  Copy
Checkbox: renaming of the files . User can use the mask. The mask items are selfexplanatory Ithink. 
The checkbox on the bottom: Automatic counter. It should work in this way: if you use this mask for example 2006-10-29 - 10.29.33.jpg ( $(CreateDate:RRRR)-$(CreateDate:MM)-$(CreateDate:DD) - $(CreateDate:hh).$(CreateDate:mm).$(CreateDate:ss)$(ext) ) you can have two or three files with the same name (if your camera's automatic shutting mode is fast enough smile) so it will lead to adding some counter to the name of the file before the extension.

Tab 4:
Summary and run button.


The app should be able to run in the system tray, and when it captures 'New device' windows system message, it shoud check if the default path is present and it could automaticly transfer the files.




Thats to the app. I know I should use all the stuff in english. That was just a learning try so I thought I won't need english naming conventions and here is the result smile

Цитата(ivashkanet)

I think it isn't a setting's problem. It is a your code problem. 

I think the 60sec gap is generated by the settings problem. If the settings are not used (when I delete the user.config file) the problem does not appear.

Should I translate the source code to english?


Thank you for your time and patience and ideas

Это сообщение отредактировал(а) orhor - 30.10.2006, 00:06
PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Правила форума VB .NET
diadiavova
  • Прежде чем задать вопрос, воспользуйтесь поиском: возможно Ваш вопрос уже обсуждался и на него был получен ответ.
  • Если такой же вопрос не найден, не стоит задавать свой вопрос в любую тему, создайте новую.
  • Заголовок темы должен отображать ее суть.
  • Содержание поста должно описывать проблему понятно, но в то же время, по возможности, лаконично. Сначала следует описать суть вопроса, потом можно привести пример кода, не вынуждайте других участников угадывать в чем Ваша проблема - телепатов здесь нет.
  • Будьте взаимно вежливы и дружелюбны.
  • При оформлении сообщений используйте форматирование, примеры кода заключайте в теги [CODE=vbnet][/CODE].
  • Также ознакомьтесь с общими правилами, действующими на всем форуме.
  • Если вопрос решен, не забывайте помечать тему решенной(вверху темы есть ссылка). Кроме того, если Вы хотите отблагодарить участников, оказавших помощь в решении, можно повысить им репутацию, в случае, если у Вас менее 100 сообщений в форуме и функция изменения репутации Вам недоступна, можете написать сюда.
  • Общие вопросы по программированию на платформе .NET обсуждаются здесь.
  • Литература по VB .NET обсуждается здесь.

Если Вам помогли и атмосфера форума Вам понравилась, то заходите к нам чаще! С уважением, diadiavova.

 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | VB .NET | Следующая тема »


 




[ Время генерации скрипта: 0.0547 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.