"Message loop has not started yet" problems

Issue #14 resolved
Ferdinando Santacroce created an issue

Good morning.

First of all, thank you for your great work! :)

I'm using NTwain in a project; in this project there's a C# .NET 3.5 assembly (assume is "Client.dll") that is called by 3rd party software. In Client.dll I use a WPF window to show acquired images.

The "scanning layer" of my Client.dll is a protocol agnostic layer; I use an ISIS "driver" and a "TWAIN driver" (NTwain, of course) and I load one of the two by reflection at every scan, depending on configuration passed to Client.dll from my 3rd party caller.

On my TWAIN driver I create and destroy a TwainSession at every scan, disposing it as recommended; all this stuff (creation, use, dispose) is made at every scan in Client.dll.

So, now the question: I'm exeperiencing a weird behavior in this scenario: the first scan runs smoothly, the second one throws "Message loop has not started yet" exception; I'm using 3 Canon devices (P-150, DR-2580, DR-9080).

To benchmark my NTWain driver I wrote a Winforms app that does the same thing Client.dll does, and using it there are no such problems. Even your WPF works.

Have you some suggestions? I think is something related to Dispatcher, but I'm a WPF noob, unfortunately. Client.dll have to use it so I need to get it work in WPF.

Thanks, Nando

Comments (4)

  1. Eugene Wang repo owner

    I've made some changes as v2.0.5 (available in nuget or from v2 source branch) so see if it works. If not I'll have to see how you're initializing and cleaning up TwainSession objects to know what's wrong.

  2. Ferdinando Santacroce reporter

    Hello Eugene. Sorry for the long wait; please consider resolved this issue. That was due to a misuse of closing methods, apparently.

    Thanks :) Nando

  3. Log in to comment