Menu

#353 System.InvalidCastException: Specified cast is not valid

1.
open
nobody
None
1
2020-03-24
2020-02-25
No

First of all: GREAT software, thanks for it. Been using it since... long time ago.

I recently moved from W7 X86 to W10 X64 and is when Im facing this problem...

Device and iCopy used to work perfectly on the W7... not working now on W10...

I've tried versions 1.7 and the one reporting... 1.6.3.32 and the no-setup version as well... with the error as a result all the times.

I get the error right after choosing the device... this is the Copy-Paste from it...


25/02/2020 02:23:40 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
Command Line parameters: /wiareg

25/02/2020 02:23:50 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)

25/02/2020 02:25:05 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)

25/02/2020 02:27:33 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)

25/02/2020 02:37:57 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)

25/02/2020 02:41:24 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)

25/02/2020 02:42:50 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)

25/02/2020 02:43:29 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)

25/02/2020 02:53:55 p. m.
iCopy Version: 1.6.3.32
Windows Version: Microsoft Windows NT 6.2.9200.0
.NET Version: 2.0.50727.9148


WIA Device count: 1
iCopy.exe Error: 0 : Exception caught.
iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.

at WIA.CommonDialogClass.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
at iCopy.appControl.changescanner(String deviceID)
at iCopy.appControl.CreateScanner(String deviceID)
at iCopy.appControl.Main(String[] sArgs)


and this is what I get from the WIA Diagnostics...


iCopy WIA Diagnosis utility

DATE: 25/02/2020 02:49:38 p. m.
OS Version: Microsoft Windows NT 6.2.9200.0
CLR Version: 2.0.50727.9148

WIAAut.dll available: True

WIA Devices

Device count: 1

Device 1

DeviceID: {6BDD1FC6-810F-11D0-BEC7-08002BE2092F}\0000
Device Type: ScannerDeviceType


WIADiagnosis encountered an exception:
System.InvalidCastException: Specified cast is not valid.
at WIA.IDeviceInfo.Connect()
at WIADiagnosis.Module1.Main()


I tried the DLL registering but Windows won't let me replace the DLL file on the System32 path (I do have a Admin account) but instead I registered the one in the iCopy installation folder thru regsvr32 and recieved the succesfully registered message.

Thanks.
Hopefully this can get fixed and if not please just tell me.

PS: I Apologize for any spelling mistake as English is not my primary language and this doesn't seem to have a spell check :D

Discussion

  • Matteo Rossi

    Matteo Rossi - 2020-02-27

    Dear carlos,

    sorry for my late response. Do you confirm that the error is the same also for version 1.7?

     
    • Carlos Perez

      Carlos Perez - 2020-03-03

      Yes. Same error. This is the text generated after clicking OK on image I'm attaching...


      03/03/2020 01:25:12 p. m.
      iCopy Version: 1.7.0.3
      Windows Version: Microsoft Windows NT 6.2.9200.0
      .NET Version: 4.0.30319.42000


      WIA Device count: 1
      Command Line parameters: /wiareg
      

      03/03/2020 01:25:13 p. m.
      iCopy Version: 1.7.0.3
      Windows Version: Microsoft Windows NT 6.2.9200.0
      .NET Version: 4.0.30319.42000


      WIA Device count: 1
      Command Line parameters: /silent /reg
      

      03/03/2020 01:25:22 p. m.
      iCopy Version: 1.7.0.3
      Windows Version: Microsoft Windows NT 6.2.9200.0
      .NET Version: 4.0.30319.42000


      WIA Device count: 1
      iCopy.exe Error: 0 : Exception caught.
      iCopy.exe Error: 0 : System.InvalidCastException: Specified cast is not valid.
      

      at WIA.ICommonDialog.ShowSelectDevice(WiaDeviceType DeviceType, Boolean AlwaysSelectDevice, Boolean CancelError)
      at iCopy.appControl.changescanner(String deviceID)
      at iCopy.appControl.CreateScanner(String deviceID)
      at iCopy.appControl.Main(String[] sArgs)


      Thanks for your attention.

       
  • Martin Butter

    Martin Butter - 2020-02-29

    Hi Carlos, I'm not an expert on this, but it struck me that in your log it's always NET-Version 2.0 instead of NET 4.0, which it's in my log. Maybe it could help to upgrade NET Framework 4 as descriped in the icopy blog: https://icopy.sourceforge.io/icopy-1-7-released/

     
    • Carlos Perez

      Carlos Perez - 2020-03-03

      Hi,

      I guess I first had the default .NET version that comes on W10 then for backwards compatibility with some old software I still need to use I had to install .NET FW 3.5 ...

      I believe I have both versiones installed, please correct me if I'm wrong....

      Attaching current screenshots from my evidence.

      Thanks.-

       
  • Carlos Perez

    Carlos Perez - 2020-03-24

    Hi...

    Just wondering ir there would be any advise for me, please.

    Thanks in advance.

     

Log in to post a comment.

MongoDB Logo MongoDB