Page 1 of 2

CoreLAb OracleConnection lets MAPI die

Posted: Fri 05 Jan 2007 22:38
by tosch
Hi,
i have a big problem! I use MAPI (via Outlook) to send mails - that works fine, but when i use the CoreLab OracleConnection and i call Open on this connection MAPI does not longer wok until i restart the Application.

HEre is the way to reprodure it:
1. Craete a new Project "Windows Application"
2. Drop a Button on the From
3. Add the following Code to the Click event:

Code: Select all

    private void button1_Click(object sender, EventArgs e)
    {
     // _Connection.Open();
      Send("SMTP:[email protected]", "Test", "Text");
    } 

4. Add the following Code to the class:

Code: Select all

    [StructLayout(LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
    public class MapiMessage
    {
      public int Reserved = 0;
      public string Subject = string.Empty;
      public string NoteText = string.Empty;
      public string MessageType = null;
      public string DateReceived = null;
      public string ConversationID = null;
      public int Flags = 0;
      public IntPtr Originator = IntPtr.Zero;
      public int RecipCount = 0;
      public IntPtr Recips = IntPtr.Zero;
      public int FileCount = 0;
      public IntPtr Files = IntPtr.Zero;
    }

    [StructLayout(LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
    public class MapiRecipDesc
    {
      public int Reserved = 0;
      public int RecipClass = 0;
      public string Name = null;
      public string Address = null;
      public int EntryIDSize = 0;
      public IntPtr EntryID = IntPtr.Zero;
    }

    [DllImport("MAPI32.DLL", CharSet = CharSet.Ansi)]
    private static extern int MAPISendMail(IntPtr lhSession, IntPtr hwndParent,
                                            MapiMessage lpMessage, int flFlags, int ulReserved);


    private static IntPtr AllocOrigin(MapiRecipDesc origin)
    {
      Type rtype = typeof(MapiRecipDesc);
      int rsize = Marshal.SizeOf(rtype);
      IntPtr ptro = Marshal.AllocHGlobal(rsize);
      Marshal.StructureToPtr(origin, ptro, false);
      return ptro;
    }
    
    private static IntPtr AllocRecips(params MapiRecipDesc[] recpts)
    {
      if (recpts.Length == 0)
        return IntPtr.Zero;

      Type rtype = typeof(MapiRecipDesc);
      int rsize = Marshal.SizeOf(rtype);
      IntPtr ptrr = Marshal.AllocHGlobal(recpts.Length * rsize);

      int runptr = (int)ptrr;
      for (int i = 0; i  Result = 26 (see Windows caption)
(I know that this is not enough code to send a mail, but it is enough to show the problem)
 
Now remove the cmment from 
 [code]// _Connection.Open();
If you restart your Application the Outlook dialog no more comes up and the result always is 2 (= MAPI_E_FAILURE)

Any Ideas how i can fix that?

Thanks
Torsten

Posted: Tue 09 Jan 2007 07:34
by Alexey
Please check if you have same problems with Direct=true in ConnectionString.

Direct works, but...

Posted: Tue 09 Jan 2007 10:57
by tosch
That works, but unfortunately i have to use the oracle client. (Our Delphi client works with the same constellation)

Posted: Wed 10 Jan 2007 07:55
by Alexey
We are investigating this problem.
You will be notified on results as soon as possible.

Posted: Thu 11 Jan 2007 07:30
by Alexey
This problem might be connected with loading unmanaged dll MAPI and Oracle client. Unfortunately, we cannot reproduce it.
Please specify your operating system, hardware architecture, paths to dlls.

Posted: Thu 11 Jan 2007 16:05
by tosch
Here is the requested information:
Betriebssystemname Microsoft Windows XP Professional
Version 5.1.2600 Service Pack 2 Build 2600
Betriebssystemhersteller Microsoft Corporation
Systemname PC-TS
Systemhersteller System Manufacturer
Systemmodell System Name
Systemtyp X86-basierter PC
Prozessor x86 Family 15 Model 2 Stepping 5 GenuineIntel ~3000 Mhz
Prozessor x86 Family 15 Model 2 Stepping 5 GenuineIntel ~3000 Mhz
BIOS-Version/-Datum Award Software, Inc. ASUS P4PE ACPI BIOS Revision 1007, 10.11.2003
SMBIOS-Version 2.3
Windows-Verzeichnis C:\WINNT
Systemverzeichnis C:\WINNT\system32
Startgerät \Device\HarddiskVolume1
Gebietsschema Deutschland
Hardwareabstraktionsebene Version = "5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)"
Benutzername AQUILANT\ts
Zeitzone Westeuropäische Normalzeit
Gesamter realer Speicher 1.024,00 MB
Verfügbarer realer Speicher 155,25 MB
Gesamter virtueller Speicher 2,00 GB
Verfügbarer virtueller Speicher 1,96 GB
Größe der Auslagerungsdatei 2,37 GB
Auslagerungsdatei D:\pagefile.sys
Oracle Client 10.2g

It seems that the problem only apears with the Oracle 10 Client.
I will sent you a working test project by PM

Regards
Torsten

Posted: Thu 11 Jan 2007 16:07
by tosch
Sorry PM is disabled :(

Posted: Thu 11 Jan 2007 16:28
by tosch
I sent a mail to support at crlab dot com with a complete project maybe you can reprodure it now (with an Oracle 10.2g Client). It works well with Oracle client 9.2.

Regards
Torsten

Posted: Fri 12 Jan 2007 07:40
by Alexey
Your project is received and now is being investigated.
Look forward to hearing from us soon.

Posted: Mon 05 Feb 2007 08:23
by tosch
Are there any news about this problem?

Posted: Mon 05 Feb 2007 15:33
by Alexey
Unfortunately, we cannot reproduce the problem on our end.
Maybe it has to do something with loading unmanaged dll MAPI and Oracle client. Maybe it is Windows or Oracle client version dependent. Maybe the paths where assemblies reside are different.
Do you have this problem on another PC?

Posted: Tue 06 Feb 2007 14:01
by tosch
This problem happens on all teseted machines with Oracle 10.2 Client and Framework 2.0

Posted: Wed 07 Feb 2007 17:20
by Alexey
We need some time for further investigation.
Thanks for your patience.

Posted: Wed 28 Mar 2007 14:50
by drzemik
I have the same problem.

It only occures on machine with clean instalation of OracleClient 10.2.

If machine has OracleClient 9.2 or it was upgraded from 9.2 to 10.2 - it works correctly. And also problem occures only if application connects to database.

Posted: Thu 29 Mar 2007 06:26
by Alexey
Please send me your project to reproduce the problem, including all third-parties (if any).
Use e-mail address provided in the Readme file.