Custom COM dll stays in memory until Notes is closed

Ok, I’m trying to be CRISPY here -

I have written a sample COM dll in C#, and used it in an LS Agent. The COM dll doesn’t do aything useful yet, but works fine (code is below, built in VS Express '08).

The problem is that once I used the DLL, it is kept in memory (meaning the file is locked and cannot be deleted) until Notes is closed. I don’t know if this is a Notes issue, or a .NET issue ( I suspect .NET ) but I know that when I use Word.Application objects I can delete the Word files (dll’s, exe’s, the whole folder) immediately after the agent finishes.

What gives?

C# code:

using System;

using System.Windows.Forms;

using System.Runtime.InteropServices;

using System.Runtime.InteropServices.ComTypes;

namespace ZIS {

[Guid("8F2E307B-8C6B-401e-BBB7-6C759232F44E"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch), ComVisible(true)]

public interface _Session{

    bool IsConnected {

        get;

    }

    void Connect(string Username, string Password);

    void Disconnect();

}



[Guid("35A29FCC-63D7-4d36-9867-2D943CCEA15E"), ClassInterface(ClassInterfaceType.None), ProgId("MyDotNET.Session"), ComVisible(true)]

public class Session : _Session {

     public bool IsConnected {

        get {

            MessageBox.Show("IsConnected?");

            bool st = false;

            return st;

        }

    }

    public void Connect(string Username, string Password) {

        try {

            MessageBox.Show("Connect: " + Username + " - " + Password);

        } catch (Exception ex) {

            MessageBox.Show(ex.ToString());

        }

    }

    public void Disconnect() {

        try {

            MessageBox.Show("Disconnect");

        } catch (Exception ex) {

            MessageBox.Show(ex.ToString());

        }

    }

}

}