Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Developer Outlook Addins > System.AccessVi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 16 Topic 1644 of 1746
Post > Topic >>

System.AccessViolationException in VSTO SE COM Add In for OL 2007

by Tom1247 <tom1247@[EMAIL PROTECTED] > Dec 30, 2007 at 11:36 AM

I am receiving the above listed error during a series of property
assignments during the close event of a contact item in a VSTO SE COM
Add In.

The premise is very simple - the contact is opened and a number of
property values are set programmatically from an Access database.
Notably the entire content of the Body is changed to what is in the
database, the contact is saved and displayed. No problems at all in
opening the contact.

On the close event, several properties are again set and the content
of the Body is parsed by a function that strips our certain unwanted
substrings, and then the Body is set to the parsed value. The contact
is saved and closes.

The problem is the following (full description) error occurs after 2
or 3 contacts are opened and then closed.

A first chance exception of type 'System.AccessViolationException'
occurred in KWCongress2007_VSTO.DLL
System.Collections.ListDictionaryInternal
Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.
Microsoft.Office.Interop.Outlook
   at Microsoft.Office.Interop.Outlook._ContactItem.set_Body(String
Body)


I have checked the code exhaustively, am using Option Strict with
every compile condition to throw a warning, and I am not getting any
warnings and the project compiles without hesitation. I've checked for
memory leaks using PerfMon and did not see any evidence of thread
stacks leaking, unmanaged memory leaking or memory in the managed
heaps building up.

The line of code that consistently causes the error and Outlook to
crash is:

oContact.Body = ParseMemberBody(sBody)

Where oContact is a strongly typed ContactItem, sBody is a strongly
typed String and ParseMemberBody is a private function that simply
iterates the sBody string and removes the unwanted substrings before
the value is set to the Body and the item is saved. I know it's not
this private function since I can't even use a simple string like
"Test body value".

I have tried releasing the item, calling GC.Collect() and getting the
item back using the EntryID - all of which works just great - but the
error still occurs.

I know it's the line referenced because I can rem it out and open and
close contacts from now to whenever without a problem. Put that line
back in and a crash is assured within a couple of open/close cycles.

I've lost two solid days on this and can not find any specific
reference to the issue. There are tons of unanswered questions about
the same error message but none about Outlook contacts and noen with
clear solutions.

Help, please!
 




 16 Posts in Topic:
System.AccessViolationException in VSTO SE COM Add In for OL 200
Tom1247 <tom1247@[EMAI  2007-12-30 11:36:39 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
"Ken Slovak - [MVP -  2007-12-31 10:52:58 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-02 15:43:59 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
"Ken Slovak - [MVP -  2008-01-03 09:48:07 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-03 12:01:48 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
"Ken Slovak - [MVP -  2008-01-04 10:30:02 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-04 08:18:45 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
"Ken Slovak - [MVP -  2008-01-04 11:57:20 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-04 17:00:27 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-05 06:14:16 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
"Ken Slovak - [MVP -  2008-01-06 17:09:10 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-05 07:44:08 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-05 08:06:17 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
"Ken Slovak - [MVP -  2008-01-06 17:09:57 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
Tom1247 <tom1247@[EMAI  2008-01-05 13:13:27 
Re: System.AccessViolationException in VSTO SE COM Add In for OL
"Ken Slovak - [MVP -  2008-01-06 17:05:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 14:35:06 CST 2008.