.NET Components for Mobility

Bug in 3.2 version with windows mobile 5.0

Last post 08-08-2008 3:38 AM by PeterFoot. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-08-2008 12:43 AM

    Bug in 3.2 version with windows mobile 5.0

     Hi,

    There is bug in u r 3.2 version mobile dll.

    this is done when new message arrives and event has to fire. Event fires, changes in the  subject on opening gwes.exe error.

    Here is the following code. 

    OutlookSession session = new OutlookSession();
    session..MessagingItemCreated += new MessagingItemEventHandler(messagingItemCreated); 

     public void messagingItemCreated(object sender, MessagingItemEventArgs e)
            {
                try
                {
                    System.Threading.Thread.Sleep(3000);
                    EmailMessage em = (EmailMessage)session.GetItemByItemId(e.ItemId);
                   
                  
                    if (isFromSubject(em.From.Address))
                    {
                        if (em.Subject.IndexOf(objConfig.rootElement) == -1)
                        {
                            updateSubjectEmail(em, session);
                        }
                    }
                }
                catch (StackOverflowException se)
                {
                    MessageBox.Show("StackOverflowException : " + se.StackTrace);
                }
                finally
                {
                    GC.Collect();
                }

            }

     

    when i am update the email message with "xyz: subject of email" .

    I am getting stack overflow exception.

    here the in the subject "xyz"+subject of email is converted.

    when i opened the email , it is giving the gwes.exe  error.

    this error is generated by the 3.2 dll

    where the Importance,size,subject and Sensitivity these four are going in stack overflow exception.

    try to figure out this.

     

    Thank you,

    Ajay Kumar R 

    Filed under:
  • 08-08-2008 3:38 AM In reply to

    Re: Bug in 3.2 version with windows mobile 5.0

    The messaging* events are callbacks from MAPI and hence occur within the messaging threads. It is not a good idea to introduce any long running process within your message handler and this may be the reason why a fault is occuring in the messaging application.

    When a message is created it will not have all it's fields populated. Therefore it is better practise to store the ItemId from a MessagingItemCreated event and then handle the MessagingItemModified event and check for a matching ItemId. Then you can process the message and be sure that the fields you want to read have been written to the message. I will post a sample project to illustrate this shortly.

    It's also not a good idea to call GC.Collect within this event handler.

    There is nothing inherent in this code which would case a StackOverflow, perhaps it is something in the updateSubjectEmail method...

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
Page 1 of 1 (2 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.