Home All Groups Group Topic Archive Search About
Author
1 Oct 2006 10:18 AM
Jarry
The CLR has been unable to transition from COM context 0x1b1f20 to COM
context 0x1b2090 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.

Hi there. I'm a bit new, and I got this Error message occasionly when I
load my program, maybe when I switch to another program when I'm
loading it up, I don't know . It has a pretty big memory consumption
when it loads up, as it loads an array from a text file, something like
this:

Dim openFileDialog1 As New OpenFileDialog()
                openFileDialog1.FileName =
My.Application.Info.DirectoryPath & "\test.txt"
        Dim sr As New System.IO.StreamReader(openFileDialog1.OpenFile)
        If Not (sr Is Nothing) Then
            For i = 1 To 50
                myArray(i) = sr.ReadLine
            Next
        End If
        sr.Close()

Because it only happens sometimes, it's hard to find what is
influencing it? Any ideas n how to stop it happening, or catch it
better?

Thanks in advance

Author
1 Oct 2006 9:40 PM
The Grim Reaper
The first most obvious thing I'd do is stick a DoEvents() in the For.. Next
loop;

For i = 1 to 50
    myArray(i) = sr.ReadLine
    Application.DoEvents()
Next

I believe that sub is in System.Windows.Forms.  As an alternative, you can
use
System.Threading.Thread.Sleep(0) instead.

I wholeheartedly agree that "COM context 0x1b1f20 to COM context 0x1b2090"
is abolutely
blinkin' useless unless you're a C++ or machine language type expert!!
__________________________________
The Grim Reaper

Show quoteHide quote
"Jarry" <HarryandJa***@gmail.com> wrote in message
news:1159697908.839175.117830@m7g2000cwm.googlegroups.com...
> The CLR has been unable to transition from COM context 0x1b1f20 to COM
> context 0x1b2090 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.
>
> Hi there. I'm a bit new, and I got this Error message occasionly when I
> load my program, maybe when I switch to another program when I'm
> loading it up, I don't know . It has a pretty big memory consumption
> when it loads up, as it loads an array from a text file, something like
> this:
>
> Dim openFileDialog1 As New OpenFileDialog()
>                openFileDialog1.FileName =
> My.Application.Info.DirectoryPath & "\test.txt"
>        Dim sr As New System.IO.StreamReader(openFileDialog1.OpenFile)
>        If Not (sr Is Nothing) Then
>            For i = 1 To 50
>                myArray(i) = sr.ReadLine
>            Next
>        End If
>        sr.Close()
>
> Because it only happens sometimes, it's hard to find what is
> influencing it? Any ideas n how to stop it happening, or catch it
> better?
>
> Thanks in advance
>