32 bit NAPS
32 bit Office (2016 & 2019)
32 bit TWAIN drivers
When you scan, and then click Email PDF, the Choose Email Provider window opens, but nothing to select. No error or anything.
I found that the problem happens in NAPS2.ImportExport.Email.Mapi/SystemEmailClients.GetDefaultName() when it finds the key HKCU\Software\Clients\Mail key, but that key has no values.
Trace:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=NAPS2.Core
StackTrace:
at NAPS2.ImportExport.Email.Mapi.SystemEmailClients.GetDefaultName() in NAPS2.Core\ImportExport\Email\Mapi\SystemEmailClients.cs:line 19
at NAPS2.WinForms.FEmailProvider.FEmailProvider_Load(Object sender, EventArgs e) in NAPS2.Core\WinForms\FEmailProvider.cs:line 36
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Simple fix is to delete the HKCU\Software\Clients\Mail key (it was completely empty on my computer). I don't know how that key got there, or why it's empty, but NAPS is the first program to dislike that.
However, adding a check to the code in SystemEmailClients.cs let the program go on with that key empty.
public string GetDefaultName()
{
using (var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Clients\Mail", false))
{
return key?.GetValue(null).ToString();
}
}
becomes
public string GetDefaultName()
{
using (var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Clients\Mail", false))
{
if (key?.GetValue(null) is null)
return null;
return key?.GetValue(null).ToString();
}
}
I should note that after I set the Provider, I can run the unmodified release (as long as I don't want to change the provider) and email works fine, so GetDefaultName() isn't called again until you want to change the provider.
Works fine for me :-)