Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++/CLI ADO.NET
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.
http://winterdom.com/2007/02/jetmapiandsta[^]
 
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) {
    ex;
}
catch (...) {
    ;
}
finally {
   if (db_Conn)
       db_Conn.close();
}
Posted 30-Aug-12 16:45pm
T21024.3K
Edited 31-Aug-12 5:42am
v5
Comments
Wes Aday at 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 at 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)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 31 Aug 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