PC Review


Reply
Thread Tools Rate Thread

Control MarshalingControl

 
 
Armin Zingler
Guest
Posts: n/a
 
      7th Apr 2011
Hi,

as you don't like long descriptions: How can I avoid or control the
creation of a MarshalingControl?

Thanks!

--
Armin
 
Reply With Quote
 
 
 
 
Jason Keats
Guest
Posts: n/a
 
      8th Apr 2011
"Armin Zingler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)-berlin.de...
> Hi,
>
> as you don't like long descriptions: How can I avoid or control the
> creation of a MarshalingControl?


As I don't like long answers:
http://code.google.com/p/retlang/


 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      8th Apr 2011
Am 08.04.2011 05:14, schrieb Jason Keats:
> "Armin Zingler" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)-berlin.de...
>> Hi,
>>
>> as you don't like long descriptions: How can I avoid or control the
>> creation of a MarshalingControl?

>
> As I don't like long answers:
> http://code.google.com/p/retlang/


That's what I can expect from my question. I thank you, though
I'm trying to elaborate a bit more:
My problem is that I got a dead-lock in my application running
two UI-threads independently. That means, I've payed great attention
to not creating a dead-lock in my own code. If you look at it, you'd
also be surprised that it can happen.
To be more specific, the line "New MyForm" does not return.
I do not do anything special in it. The window handle of the
Form is also not created inside because I do know that it
could cause a dead-lock. That's why *I* avoided it. However,
*the FW* internally creates a MarshallingControl and it's handle
inside "New MyForm". I'm a bit lost how to avoid this.


--
Armin
 
Reply With Quote
 
Tom Shelton
Guest
Posts: n/a
 
      8th Apr 2011
Armin Zingler laid this down on his screen :
> Am 08.04.2011 05:14, schrieb Jason Keats:
>> "Armin Zingler" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)-berlin.de...
>>> Hi,
>>>
>>> as you don't like long descriptions: How can I avoid or control the
>>> creation of a MarshalingControl?

>>
>> As I don't like long answers:
>> http://code.google.com/p/retlang/

>
> That's what I can expect from my question. I thank you, though
> I'm trying to elaborate a bit more:
> My problem is that I got a dead-lock in my application running
> two UI-threads independently. That means, I've payed great attention
> to not creating a dead-lock in my own code. If you look at it, you'd
> also be surprised that it can happen.
> To be more specific, the line "New MyForm" does not return.
> I do not do anything special in it. The window handle of the
> Form is also not created inside because I do know that it
> could cause a dead-lock. That's why *I* avoided it. However,
> *the FW* internally creates a MarshallingControl and it's handle
> inside "New MyForm". I'm a bit lost how to avoid this.


Armin - I'm having a bit of trouble following what your trying to
accomplish here... There shouldn't be an issue just creating forms on
different threads - is there some whay you could create a smallish
example that demonstrates your problem?

--
Tom Shelton


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      8th Apr 2011
Am 08.04.2011 20:30, schrieb Tom Shelton:
> Armin Zingler laid this down on his screen :
>> Am 08.04.2011 05:14, schrieb Jason Keats:
>>> "Armin Zingler" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)-berlin.de...
>>>> Hi,
>>>>
>>>> as you don't like long descriptions: How can I avoid or control the
>>>> creation of a MarshalingControl?
>>>
>>> As I don't like long answers:
>>> http://code.google.com/p/retlang/

>>
>> That's what I can expect from my question. I thank you, though
>> I'm trying to elaborate a bit more:
>> My problem is that I got a dead-lock in my application running
>> two UI-threads independently. That means, I've payed great attention
>> to not creating a dead-lock in my own code. If you look at it, you'd
>> also be surprised that it can happen.
>> To be more specific, the line "New MyForm" does not return.
>> I do not do anything special in it. The window handle of the
>> Form is also not created inside because I do know that it
>> could cause a dead-lock. That's why *I* avoided it. However,
>> *the FW* internally creates a MarshallingControl and it's handle
>> inside "New MyForm". I'm a bit lost how to avoid this.

>
> Armin - I'm having a bit of trouble following what your trying to
> accomplish here... There shouldn't be an issue just creating forms on
> different threads - is there some whay you could create a smallish
> example that demonstrates your problem?


Thanks Tom for asking. Smallish is difficult. But I try to describe:
I wrote a TraceListener. It starts a new thread. The thread creates
a Form to display the output of the TraceListener. The TraceListener
must wait a short moment until the Form has been created:

Thread:
f_Form = New Traceform
FormCreatedEvent.Set

Listener:
FormCreatedEvent.WaitOne

WaitOne must be used carefully. I myself didn't put any blocking code into
"New Traceform", therefore it's ok here. I've put TraceListener+Form into
a Dll and have used it from several projects (successfully).


In my current project, I'm using the library, too. I put Debug.Writeline into
the WndProc of my startup Form. Result: Freeze at start-up. I found out that
the main thread is stuck in

CreateHandle -> WndProc -> Debug.Writeline -> TraceListener -> FormCreatedEvent.WaitOne

I wondered why WaitOne still waits because "New TraceForm" in the other thread
should be done in a millisecond. So, why does "New TraceForm" not return? The
callstack shows:

New TraceForm -> .... -> New MarshalingControl -> MarshalingControl.Creathandle


Conclusion: While the main thread is inside CreateHandle waiting for the
Form in the other thread being created, that thread is also inside
CreateHandle trying to create the MarshalingControl. The FW synchronizes
simultaneous creation of window handles from different threads. That's ok,
and I don't do it myself, but due to that MarshalingControl which is out
of my own scope of responsibility, the dead-lock occurs.

--
Armin
 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Apr 2011
Am 08.04.2011 22:16, schrieb Armin Zingler:
>> Armin - I'm having a bit of trouble following what your trying to
>> accomplish here... There shouldn't be an issue just creating forms on
>> different threads - is there some whay you could create a smallish
>> example that demonstrates your problem?

>
> Thanks Tom for asking. Smallish is difficult. But I try to describe:
> I wrote a TraceListener. It starts a new thread. The thread creates
> a Form to display the output of the TraceListener. The TraceListener
> must wait a short moment until the Form has been created:
>
> Thread:
> f_Form = New Traceform
> FormCreatedEvent.Set
>
> Listener:
> FormCreatedEvent.WaitOne
>
> WaitOne must be used carefully. I myself didn't put any blocking code into
> "New Traceform", therefore it's ok here. I've put TraceListener+Form into
> a Dll and have used it from several projects (successfully).
>
>
> In my current project, I'm using the library, too. I put Debug.Writeline into
> the WndProc of my startup Form. Result: Freeze at start-up. I found out that
> the main thread is stuck in
>
> CreateHandle -> WndProc -> Debug.Writeline -> TraceListener -> FormCreatedEvent.WaitOne
>
> I wondered why WaitOne still waits because "New TraceForm" in the other thread
> should be done in a millisecond. So, why does "New TraceForm" not return? The
> callstack shows:
>
> New TraceForm -> .... -> New MarshalingControl -> MarshalingControl.Creathandle
>
>
> Conclusion: While the main thread is inside CreateHandle waiting for the
> Form in the other thread being created, that thread is also inside
> CreateHandle trying to create the MarshalingControl. The FW synchronizes
> simultaneous creation of window handles from different threads. That's ok,
> and I don't do it myself, but due to that MarshalingControl which is out
> of my own scope of responsibility, the dead-lock occurs.


I kept it as comprehensive and short as possible. I am unable to do better.



--
Armin
 
Reply With Quote
 
Tom Shelton
Guest
Posts: n/a
 
      12th Apr 2011
Armin Zingler presented the following explanation :
> Am 08.04.2011 22:16, schrieb Armin Zingler:
>>> Armin - I'm having a bit of trouble following what your trying to
>>> accomplish here... There shouldn't be an issue just creating forms on
>>> different threads - is there some whay you could create a smallish
>>> example that demonstrates your problem?

>>
>> Thanks Tom for asking. Smallish is difficult. But I try to describe:
>> I wrote a TraceListener. It starts a new thread. The thread creates
>> a Form to display the output of the TraceListener. The TraceListener
>> must wait a short moment until the Form has been created:
>>
>> Thread:
>> f_Form = New Traceform
>> FormCreatedEvent.Set
>>
>> Listener:
>> FormCreatedEvent.WaitOne
>>
>> WaitOne must be used carefully. I myself didn't put any blocking code into
>> "New Traceform", therefore it's ok here. I've put TraceListener+Form into
>> a Dll and have used it from several projects (successfully).
>>
>>
>> In my current project, I'm using the library, too. I put Debug.Writeline
>> into the WndProc of my startup Form. Result: Freeze at start-up. I found out
>> that the main thread is stuck in
>>
>> CreateHandle -> WndProc -> Debug.Writeline -> TraceListener ->
>> FormCreatedEvent.WaitOne
>>
>> I wondered why WaitOne still waits because "New TraceForm" in the other
>> thread should be done in a millisecond. So, why does "New TraceForm" not
>> return? The callstack shows:
>>
>> New TraceForm -> .... -> New MarshalingControl ->
>> MarshalingControl.Creathandle
>>
>>
>> Conclusion: While the main thread is inside CreateHandle waiting for the
>> Form in the other thread being created, that thread is also inside
>> CreateHandle trying to create the MarshalingControl. The FW synchronizes
>> simultaneous creation of window handles from different threads. That's ok,
>> and I don't do it myself, but due to that MarshalingControl which is out
>> of my own scope of responsibility, the dead-lock occurs.

>
> I kept it as comprehensive and short as possible. I am unable to do better.


Hmmmm... I'm not seeing an obvious answer atm. I might have to play
with this a bit - if I get time.

--
Tom Shelton


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Apr 2011
Hi,

project to reproduce:

http://www.file-upload.net/download-...ntrol.zip.html

Please note that some code has been copied and pasted
from several sources to make it work.

--
Armin
 
Reply With Quote
 
Jason Keats
Guest
Posts: n/a
 
      14th Apr 2011
Armin Zingler wrote:
> Hi,
>
> project to reproduce:
>
> http://www.file-upload.net/download-...ntrol.zip.html
>
> Please note that some code has been copied and pasted
> from several sources to make it work.
>


I think you mean that you've copied and pasted the minimum code required
to show it doesn't work. :-)

It's still impressively complicated, Armin.

I put together a simpler version, that seems to work:
http://member.melbpc.org.au/~jkeats/...ceListener.zip

BTW, I still think retlang might provide a (better) solution. I just
haven't had time to prove it.

 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      14th Apr 2011
Am 14.04.2011 16:22, schrieb Jason Keats:
> Armin Zingler wrote:
>> Hi,
>>
>> project to reproduce:
>>
>> http://www.file-upload.net/download-...ntrol.zip.html
>>
>> Please note that some code has been copied and pasted
>> from several sources to make it work.
>>

>
> I think you mean that you've copied and pasted the minimum code required
> to show it doesn't work. :-)


:-)

I meant: "...to make it /compile/."


> It's still impressively complicated, Armin.


Why? Just start it, break, and switch to the thread named "TraceForm".

> I put together a simpler version, that seems to work:
> http://member.melbpc.org.au/~jkeats/...ceListener.zip


Jason, thanks a lot for taking the time. However, I am talking about a
multi-threading issue. You do not start a new thread in your project,
so I don't see the relation to my problem.

> BTW, I still think retlang might provide a (better) solution. I just
> haven't had time to prove it.


I haven't looked at it yet. Actually I'm interested if I did anything wrong.
I'm pretty sure I did not - though it doesn't work.

--
Armin
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile errors when using form control's "Control Source" property to refer to the control's value Yarik Mezheritskiy Microsoft Access Form Coding 3 5th Nov 2004 02:56 AM
Showing 1 control inside a 2nd control where the 2nd control is a derived control. malcolm Microsoft Dot NET Framework Forms 0 10th Jun 2004 10:29 PM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden Microsoft VB .NET 1 11th Oct 2003 08:09 PM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden Microsoft ASP .NET 1 11th Oct 2003 08:09 PM
Using Table control in a custom composite control. Control does not render properly in design time. jb_in_marietta@yahoo.com Microsoft ASP .NET 0 1st Jul 2003 10:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:03 AM.