How to troubleshoot by setting TWAINDSM environment variable?

By setting an environment variable you can create a log file from the DSM that may help narrow down the Dynamic .NET TWAIN issue.
Please follow the steps below:
1. Rename the twain_32.dll (under C:Windows) to twain_32.dll_1 or any other names.
By default, your TWAIN application will use twain_32.dll rather than TWAINDSM.dll. To force the TWAINDSM to be used to create the log, we need to delete (or just rename) twain_32.dll.
NOTE:
If you got the following message when renaming twain_32.dll, please refer to FAQ (the bottom of the article).

2. Set an environment for TWAINDSM
Right click "My Computer" | Properties | (Advanced system settings) |Advanced tab | click on "Environment Variables", New
variable name: TWAINDSM_LOG
variable value: D:twain.log

OK| OK| OK.
3. Run TWAIN Application. If debugging using a IDE, like Visual Studio, restart it.
4. Navigate to the path you specified in "variable value" to see if the log file has been created. You can view the log file for troubleshooting. Or, you can send the log file to support[at]dynamsoft.com. We willl check it for you.
FAQ:
I got "You need to provide administrator permission to rename to file" when renaming the twain_32.dll.
Solution
1. Right click on twain_32.dll | Properties | Security tab | click on "Advanced" | Owner tab | click on "Edit" | highlight the current user in the list | OK | OK.

2. Back to the "Security" tab | click "Edit" | highlight the current user | add permissions | OK.

3. You should be able to rename the DLL now.