1

I am trying to connect to a Domino Session which works fine when testing in isolation, however as soon as I put it in a thread I run into problems.

This works fine when I put in a Unit test, so I know I can connect to the server fine.

NotesSession session = new NotesSession();
string  DominoPassword = Helpers.GetConfigSetting("DominoPassword");
session.Initialize(DominoPassword);

However when I put this in a thread (want to be able to connect to Domino several times) I get the following error "{Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}"

Jonk
  • 41
  • 1
  • 4

1 Answers1

0

A couple of years ago I definitely got farther than this with testing of multi-threaded Domino Interop in C#. I don't recall seeing that error. It might be due to a difference between our respective dev/test environments. It's long enough ago, though, that I don't recall what my environments were when I ran my tests.

But whether or not the Domino objects are thread-safe remains an open question. See here. As far as I know, IBM has never said that they are. (Also, last time I checked, IBM said that the classes are not supported on Win64 platforms even in Win32 applications, so that might be entering into your problem.

Community
  • 1
  • 1
Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
  • Hi Richard, thanks for the reply, I saw your original comment in Stack Overflow, not sure its the 32/64 problem as I can get the connection to work when I take it out of the threading. Do you have the code you used to get the threading to work? Just wanted to check its the same I have. Thanks – Jonk Mar 26 '14 at 04:51
  • I'm nor sure. I'll have to look for it. It was probably on a dev VM, which probably still exists, but I'll have to find it. – Richard Schwartz Mar 26 '14 at 07:14
  • I did find the code. I can post it somewhere for you if you want, but the key difference does stand out. I initialized the NotesSession in main, used it to retrieve a document, and dispatched the document to a thread. I did not try to initialize a new NotesSession per thread. If I needed anything above the level of the NotesDocument that was passed into the thread, I used doc.parent to get the NotesDatabase, and db.parent to get the NotesSession. I designed my code to assure that threads would not be working in the same database, view, etc. – Richard Schwartz Mar 26 '14 at 15:31
  • 1
    Yes thanks for this, I just did the same and it worked. Thanks for coming back to me! – Jonk Mar 26 '14 at 23:30