Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Running method IviDCPwr.Create(DC_DeviceName) causes DriverClassCreationException

What a problem could it be (See subject)?

 

Variable "DC_DeviceName" == DC (logical name I created in MAX)

 

Message of exception is:

"IviSessionFactory: An instance of the specific driver referenced by the driver session name could not be created, or did not support the specified type.\r\nSpecific driver (software module): NationalInstruments.ModularInstruments.NIDCPower 14.1.0 Fx45\r\nClass name: NationalInstruments.ModularInstruments.NIDCPower.NIDCPower, NationalInstruments.ModularInstruments.NIDCPower.Fx45, Version=14.1.45.49153, Culture=neutral, PublicKeyToken=4FEBD62461BF11A4"

 

InnerException of  exception above is:

{"Unable to cast object of type \"NationalInstruments.ModularInstruments.NIDCPower.NIDCPower\" to type \"Ivi.Driver.IIviDriver\"."}

 

Logical name and driver session in MAX are properly (as it seems to me) configured.

 

Images of Max-settings and exception are attached as well.

Please, help.

Download All
0 Kudos
Message 1 of 3
(2,296 Views)

PeterSevos,

 

Thank you for posting on our forums. 

 

In order to better assist you could you please provide me with more information as to your overall goal of this application? What are you trying to accomplish in your code when you get this error?

 

Also, have you double checked to make sure you have all the appropriate drivers installed as well as the IVI Shared Components?

 

Patrick O.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 3
(2,255 Views)

Hello! I have been briefly looking into this issue. Hopefully I can help.

 

  • I created a "DC" logical name in NI MAX and pointed it to the niDCPower driver session.
  • In the niDCPower Driver Session, under the General tab, I selected Simulate With nisDCPwr.
    • Have you tried using simulation first to see if you get the same error?
  • In the niDCPower Driver Session, under the Software tab I selected NationalInstruments.ModularInstruments.NIDCPower.Fx45 for the software module.
    • What version of NIDCPower is your project referencing? Is it referencing 14.1 and the correct Fx version (45)?
    • What are the versions of Ivi.Driver and Ivi.DCPwr in your project?

Following those steps, I was able to successfully get an NIDCPower session. I went ahead and validated that I could create it using the IVI Factory, and cast it to an IIviDriver and an NIDCpower object. The following code ran successfully for me.

 

           IIviDCPwr iIviDCPower = IviDCPwr.Create("DC", true, true);
           IIviDriver iIviDriver = (IIviDriver)iIviDCPower;
           NIDCPower dcPower = (NIDCPower)iIviDriver;

Thank you!

 

 

 

0 Kudos
Message 3 of 3
(2,234 Views)