Click here to Skip to main content
13,143,774 members (33,903 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am perplexed figuring out why a malformed query of a gmail account in outlook crashes my application instead of simply raising an exception. Seems that there is an uncaught win32 exception based on calling the code from unmanaged C++. The error goes away when I change the outlook profile location. I still don't understand why my .NET code could not catch the exception as I had nested > 20 exceptions to try to catch the issue.

I also can't directly debug the code in .NET since I am unable to set the STAAttribute and my compiler Visual Studio 2010 Professional doesn't allow me to debug C++/CLI code.[^]

The query error is simple with # missing on a date
SELECT * FROM inbox WHERE Body Like '%BWIC%' And rECEIVED>=#07/26/2012

I've tried adding many exceptions to the catch statement, but can't prevent the crash.

System::Data::DataSet ^db_DataSet=gcnew System::Data::DataSet;	
int const Fill_Result=db_Adapter.Fill(db_DataSet);
catch (System::Exception ^ex) {
catch (...) {
finally {
   if (db_Conn)
Posted 30-Aug-12 15:45pm
Updated 31-Aug-12 4:42am
Wes Aday 31-Aug-12 10:54am
"when I change the outlook profile location"... perhaps you should examine why the crash goes away when you change the location.
T2102 31-Aug-12 11:12am
Unfortunately it's not consistent and may have been a coincidence. The article I reference indicates that the ole provider for outlook is meant to be run in STA instead of MTA. Otherwise you get an error such as " System.Data.OleDb.OleDbException: There are no MAPI clients installed on this machine. Install a MAPI client (like Outlook) on this machine." I think .NET and the provider may be the source of the problem, but I still can't figure out why it can't catch an exception.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 31 Aug 2012
Copyright © CodeProject, 1999-2017
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