Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows C#4.0
 btnChangeImage.Click += (s, e) => {
                //var t = new Thread((ThreadStart)(() =>
                //{
                    using (OpenFileDialog fd = new OpenFileDialog())
                    {
                        fd.Title = "Select an Image of your";
                        if (fd.ShowDialog() == DialogResult.OK)
                        {
                            pbStaffmage.Image = PersonImage = Image.FromFile(fd.FileName);
                        }
                    }
                    
                    PERSON_IMAGE pI = new PERSON_IMAGE();
                    pI.PERSONS_IMAGE = imageToByteArray(PersonImage);
                    pI.PERSON_ID = _Person.ID;
                    // _Person.PERSON_IMAGE.PERSON_ID
                    Db.PERSON_IMAGEs.InsertOnSubmit(pI);
                    Db.SubmitChanges();
                  
                
            //    }));

            //    t.SetApartmentState(ApartmentState.STA);
            //    t.Start();
            //    t.Join();
            };
 
This error Occured
 
The CLR has been unable to transition from COM context 0x2210c40 to COM context 0x2210e90 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.
 
How to solve this error?
Posted 26-Dec-12 11:44am
Comments
jibesh at 26-Dec-12 21:41pm
   
can you providen some more details about the code. we have no clue about the data type of the variable DB and has any C++ wrapper gets called in the execution flow? on executing which line you are getting this exception? what are you trying to achieve ?
Yaseer Arafat at 27-Dec-12 12:15pm
   
Error Occurred in Db.SubmitChanges();
DB is a DBML files datacontext variable
thursunamy at 27-Dec-12 9:02am
   
You can review
http://stackoverflow.com/questions/2747916/the-clr-has-been-unable-to-transition-from-com-context-for-60-seconds
 
http://dotnetdud.blogspot.com/2009/01/clr-has-been-unable-to-transition-from.html

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 345
1 _Amy 210
2 Peter Leow 175
3 Nirav Prabtani 167
4 Andreas Gieriet 160
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,597
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100