none
When calling the Unmanaged method IsEMRPresent from Managed code getting the error CS0428: Cannot convert method group' to non-delegate type 'object'. RRS feed

  • Question

  • Hi,

    I migrated the project from VS2005 to VS2017, And when i am running the application, I am unable to call the Unmanaged (C++ dll function) from the Managed code (C# console application). 

    It is throwing the below error:

    "IsEMRPresent error CS0428: Cannot convert method group 'IsEMRPresent' to non-delegate type 'object'. Did you intend to invoke the method?" 

    and also showing the below exception as well:

    error CS0119: "Exception" is a type, which is not valid in the given context.

    Below is my Managed code and from here i am calling the Unmanaged function (IsEMRPresent)

    ValidateEMR\InstallerTasks.cs

        namespace ValidateEMR
        {
            class InstallerTasks
            {
                [DllImport("drvutil.dll", CallingConvention = CallingConvention.Cdecl)]
                public static extern Boolean IsEMRPresent();

            }

    public static int Main(String[] args)
                {
                    int retVal = ERROR_FAILURE;
                    String install = "INSTALL";
    try
                    {
                        if (args.Length == 1)
                        {

                            if (args[0].Equals(install))
                            {
                                 if (IsEMRPresent())

    And the Function definition in the Unmanaged code is like as shown below in drvutil.cpp

        BOOL IsEMRPresent()
        {
            BOOL    bRetValue = FALSE;
            BOOL    bRetry = TRUE;
            DWORD   retry_comms;

            if (GetApcUpsType())
            {       
                bRetValue = TRUE;
            }
    Do i need to do any other settings in the C++ or C# project?
    Please help me to resolve.

                                   
    Friday, October 12, 2018 9:10 AM

Answers

  • The code you posted doesn't compile. There are missing files, cross project references that we don't have and build events that copy files to non-existent locations. I had to strip your code down to the bare minimum.

    Problems:

    1) You should never put a full path into a DllImport. It isn't going to work on most machines other than your own. Only specify the DLL name (or a subfolder in your project). Any other path requirements need to be handled at the OS level by using a shared path and/or environment variables.

    2) Since you're building a native x86 DLL you must build your C# app as an x86 binary as well. Otherwise it might try to use x64 and that will fail. Note that if you compile for Any CPU then there is a property option called Prefer 32-bit which is supposed to work around this. But since you are calling native code there is no reason not to simply build for x86.

    3) So this would work for me I modified the native project's build event to copy to the output directory of the ValidateUPS project so the DLL could be found.

    4) In your C++ project you are using both a .DEF file and DLLEXPORT. You don't need both. I removed the .DEF as this is old school. However that then indicated that your DLLEXPORT wasn't actually doing anything. You didn't put it on your function definition so it wasn't being used. 

    Adding it didn't change anything because it is conditionally defined for IS_DLL whereas you're not using that directive in your code. You're using DRVUTIL_EXPORTS. I changed the preprocessor directive settings to define IS_DLL so the DLLEXPORT macro works.

    5) You put your extern "C" inside the header file but it needs to be on the function definition. So the updated definition is.

    extern "C" BOOL __declspec(dllexport)  IsUPSPresent()
    {
    ...
    }

    6) The return value in the C# code needs to be marked as MarshalAs.Bool otherwise it won't convert properly.

    [DllImport("drvutil.dll", CallingConvention = CallingConvention.Cdecl)]
    [return:MarshalAs(UnmanagedType.Bool)]        
    public static extern Boolean IsUPSPresent();

    After that, the code works.


    Michael Taylor http://www.michaeltaylorp3.net

    Monday, October 15, 2018 5:29 PM
    Moderator
  • My running theory is the issue is that you are missing a dependency so your native DLL isn't loading. In your C++ code you're referencing another C++ project. Does that project produce a DLL? If so then that DLL needs to reside in the output directory next to your C++ DLL and both need to be copied into the output directory of your ValidateUPS project.

    That is what the build event I mentioned does. 

    copy "$(TargetPath)" "..\Install\Setup Files\compressed Files\Language Independent\Intel 32"
    copy "$(Configuration)\drvutil.lib" ..\common\libs
    
    echo This is the important stuff to copy into the C# project - assuming you may have other DLLs that need to be copied as well
    copy "$(TargetDir)*.dll" "$(SolutionDir)ValidateUPS\bin\$(Configuration)"
    copy "$(TargetDir)*.pdb" "$(SolutionDir)ValidateUPS\bin\$(Configuration)"
    

    Your .DEF file is gone so I removed it from the project.

    The code you keep posting won't compile. It references code we don't have so there is no way to help you with this. I keep stripping it down to just the drvutil file. Because nothing else is available the amount of changes to your project to get just that one file to work is high. Hence I rip everything out which may be impacting the behavior I'm seeing vs yours. But with just a drv.cpp your project will be properly loaded into the C# process and run. Here's what I have.

    //drvutil.h
    #ifndef _APC_DRVUTIL_HEADER_
    #define _APC_DRVUTIL_HEADER_
    
    #ifdef IS_DLL
       #define DLLEXPORT __declspec(dllexport)
    #else 
       #define DLLEXPORT
    #endif
    
    //This is the important part - expose as C function to avoid mangling and ensure it is exported
    extern "C" {
    BOOL DLLEXPORT IsUPSPresent();
    } // extern C
    
    #endif
    
    //drvutil.cpp
    // drvutil.cpp : Defines the entry point for the DLL application.
    //
    // rfallon 04Apr2001: Took out newdev.lib dependency. See commentary.
    
    #include <windows.h>
    #include <setupapi.h> // for SetupDiXxx functions.
    #include <tchar.h>
    #include <memory>
    #pragma hdrstop
    
    //Need this for the DLLEXPORT macro
    #include "drvutil.h"
    
    /*
    Routine Description:
    
        The function will check to see if an APC UPS device is present before we 
        try to disable Native Power Management
    
    Arguments:
    
        Nothing.
    
    Return Value:
    
        TRUE is returned if there is an APC UPS Device present, otherwise FALSE
        
    */
    
    //Export as C function
    extern "C"  BOOL DLLEXPORT IsUPSPresent()
    //BOOL IsUPSPresent()
    {
        //Just return a value
        return TRUE;
    }

    So here's where I'm going with all this. Are you sure your C++ project is even compiling? Is it even going to the correct path you think it is? Go into Windows Explorer and completely delete the bin and obj directories from your projects. Then rebuild. Then go back into ValidateUPS and verify all the binaries are there. If any are missing then you'll get the error you're seeing. You need to fix this otherwise nothing works.



    Michael Taylor http://www.michaeltaylorp3.net

    • Marked as answer by Satyaprakash A Wednesday, October 17, 2018 10:15 AM
    Tuesday, October 16, 2018 2:57 PM
    Moderator

All replies

  • Show the C# code where IsEMRPresent probably appears without “( )” parentheses, and also the code where the problem about Exception is reported. See the Error List window in Visual Studio.


    Friday, October 12, 2018 10:05 AM
  • IsEMRPresent is there with parenthesis like as shown below:

    if (IsEMRPresent())

    Friday, October 12, 2018 10:13 AM
  • You aren't showing us all the code so I'm guessing here. The code you posted won't even compile.

    Your IsEMRPresent method is defined in InstallerTasks but your Main method is not so you have to use the full type name.

    if (InstallerTasks.IsEMRPresent())

    The actual error is that the compiler sees a function call (which it calls a delegate) and it cannot convert it to an object. That doesn't really seem to line up with the line you posted as the call but I guess if the compiler got confused it could go that route. Every compiler error points to the exact line causing the issue so if it is the IF line you posted then using the correct name should resolve the issue.


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, October 12, 2018 1:51 PM
    Moderator
  • Hi,

    My code is compiling without any issues.

    When I am running the application, IsEMRPresent method is calling from InstallerTasks within the Main() method. The definition is there in drvutil.cpp. But the control is not going to the definition.

    Friday, October 12, 2018 2:46 PM
  • That isn't possible. You said you're getting CS0428, that is a compiler error from C#. So if your code is compiling then where are you seeing this error from?

    "But the control is not going to the definition."

    That would have nothing to do with the error you're referencing in your OP. I have no idea what you mean by a control not going to a definition. There is no control mentioned in your code. Are you trying to say that the native call isn't being made? If so then how do you know that vs it is making the call and failing? Have you tried debugging your code in the debugger? Do you have logging enabled such that you can see the error(s) that are occurring?

    Looking at your native vs managed signature, the return type isn't correct. bool is C# is a boolean value. BOOL in C++ is an integral value. You need to map the return type to the appropriate unmanaged type.

    [DllImport("drvutil.dll", CallingConvention = CallingConvention.Cdecl)]
    [returns: MarshalAs(UnmanagedType.Bool)]
    public static extern bool IsEMRPresent ();


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, October 12, 2018 3:00 PM
    Moderator
  • Sorry for the confusion. I am seeing this error when running the application and from "IsEMRPresent()", when i selected quick watch i am seeing this error. I mean for "control is not going to the definition" as you said it is "native call isn't being made". It is not going to the native code. 

    As you said i will try with your changes. Replacing boolean with bool in C#

    And will use MarshalAs.

    Saturday, October 13, 2018 12:19 PM
  • Hi Satyaprakash A,

    Because the code is not complete, I could not reproduce the issue on my side, I create a simple demo as below, which works well. 

    C++ dynamic dll.

    // drvutil.cpp : Defines the exported functions for the DLL application.
    //
    
    #include "stdafx.h"
    
    
    
    
    int GetApcUpsType()
    {
    	return 1;
    }
    
    extern "C" __declspec(dllexport)
    BOOL IsEMRPresent()
    {
    	BOOL    bRetValue = FALSE;
    	BOOL    bRetry = TRUE;
    	DWORD   retry_comms;
    
    	if (GetApcUpsType())
    	{
    		bRetValue = TRUE;
    	}
    	return bRetValue;
    }
    

    # C# console app

     const string DLLPath2 = @"D:\relatedpath\drvutil.dll";
            [DllImport(DLLPath2, CallingConvention = CallingConvention.Cdecl)]
            public static extern Boolean IsEMRPresent();
    
    
            static void Main(string[] args)
            {
                
                var test = IsEMRPresent();
    
              
    
                Console.ReadKey();
            }

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 15, 2018 2:45 AM
    Moderator
  • Hi,

    I tried your sample but i am getting the error  "Unhandled exception at 0x7705D6C7 (ntdll.dll) in Sampletest.exe: 0xC0000096: Privileged instruction."

    Below are the steps i followed:

    Managed C# code:
    (Created a  project (Sampletest) from Visual C# -> Console App)
    Sampletest:

    namespace Sampletest
    {
        class Program
        {
            const string Dllpath2 = @"C:\Users\apc\source\repos\Sampletest\SampleDll\Debug\SampleDll.dll";
            [DllImport(Dllpath2, EntryPoint = @"IsUPSPresent", CallingConvention = CallingConvention.Cdecl)]
            public static extern Boolean IsUPSPresent();
            static void Main(string[] args)
            {
                var test = IsUPSPresent();

                Console.ReadKey();
            }
        }
    }

    Unmanaged C++ code:

    (Created a dll project (SampleDll) from Visual C++ -> Windows Desktop -> Dynamic Link Library)

    "IsUPSPresent()" definition is there in SampleDll.cpp

    #include "stdafx.h"

    BOOL IsUPSPresent()
    {
    BOOL    bRetValue = FALSE;

    return bRetValue;
    }

    But when we are making unmanaged call, first it is going to  dllmain.cpp file present in unmanaged code.

    #include "stdafx.h"

    BOOL APIENTRY DllMain( HMODULE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
                         )
    {
        switch (ul_reason_for_call)
        {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
        }
        return TRUE;
    }

    then it is not going to

    BOOL IsUPSPresent() function 

    and comming back to the managed call at "var test = IsUPSPresent();"

    showing the error "Unhandled exception at 0x7705D6C7 (ntdll.dll) in Sampletest.exe: 0xC0000096: Privileged instruction.

    Settings i Made:

    For C# project,

    Debug-> Selected "Enable native code debugging"

    And I selected "Debug", "x86"

    Please help me.

    Monday, October 15, 2018 7:02 AM
  • Hi Satyaprakash A,

    Do you add the following line of code on your method.

    extern "C" __declspec(dllexport)

    If the issue still exist, please share it via OneDrive.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 15, 2018 8:16 AM
    Moderator
  • Hi Zhanglong,

    Now i have added extern "C" __declspec(dllexport). But still seeing the same error.

    I think some components are missing in visual studio.

    I shared the complete code of the sample application in the above post.

    If you want i will share it trough OneDrive. But to which mail id can I share?

    Regards,

    Satyaprakash

    Monday, October 15, 2018 8:37 AM
  • Hi Satyaprakash A,

    I have upload my sample into OneDrive, please check if it works for you.

    https://1drv.ms/u/s!AlvaNEnglADDqlCiPBxgasEByicn

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 15, 2018 8:51 AM
    Moderator
  • Hi Zhanglong,

    I build and run your sample and it is working.

    But still my project is not working.

    I followed inline with your sample and given the complete DLL path like as you have given.

    const string Dllpath2 = @"E:\drvutil\Debug\drvutil.dll";

    Now it is showing the below error message from IsUPSPresent();

    System.DllNotFoundException: "Unable to load DLL "E:\drvutil\Debug\drvutil.dll": The specified module could not be found.

    But the dll is present in the specified path.

    Please help me why it is showing that error?

    Monday, October 15, 2018 10:42 AM
  • Have you fixed the return type with MarshalAs yet?

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, October 15, 2018 1:52 PM
    Moderator
  • Hi,

    I have tested the return type using MarshAs but still getting the same error.

    [returns: MarshalAs(UnmanagedType.Bool)]

    Monday, October 15, 2018 2:29 PM
  • You tested it against your original code or the code that Zhanglong was giving you that was returning a completely different error and therefore is a completely different problem?

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, October 15, 2018 2:30 PM
    Moderator
  • Also, your OP mentioned compiler errors which you said weren't right. So please post the updated code you are using now including the C# and C++ side. Also post the exact error message you're getting at runtime. The callstack would be a good thing to have as well. All this is available from the exception that you should be getting.

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, October 15, 2018 2:31 PM
    Moderator
  • HI,

    when I run the project i am getting the below error message.

    it is showing the below error message from IsUPSPresent() that is there in ValidateUPS project of InstallerTasks file.

    System.DllNotFoundException: "Unable to load DLL "E:\drvutil\Debug\drvutil.dll": The specified module could not be found.

    But the dll is present in the specified path.

    Below is the place where i uploaded both C++ (drvutil) (drvutil.cpp file) and C# (ValidateUPS) (InstallerTasks file)projects.

    https://1drv.ms/f/s!ApfxXg0ntrvwbplgj_jMgyep4IA

    Monday, October 15, 2018 4:08 PM
  • The code you posted doesn't compile. There are missing files, cross project references that we don't have and build events that copy files to non-existent locations. I had to strip your code down to the bare minimum.

    Problems:

    1) You should never put a full path into a DllImport. It isn't going to work on most machines other than your own. Only specify the DLL name (or a subfolder in your project). Any other path requirements need to be handled at the OS level by using a shared path and/or environment variables.

    2) Since you're building a native x86 DLL you must build your C# app as an x86 binary as well. Otherwise it might try to use x64 and that will fail. Note that if you compile for Any CPU then there is a property option called Prefer 32-bit which is supposed to work around this. But since you are calling native code there is no reason not to simply build for x86.

    3) So this would work for me I modified the native project's build event to copy to the output directory of the ValidateUPS project so the DLL could be found.

    4) In your C++ project you are using both a .DEF file and DLLEXPORT. You don't need both. I removed the .DEF as this is old school. However that then indicated that your DLLEXPORT wasn't actually doing anything. You didn't put it on your function definition so it wasn't being used. 

    Adding it didn't change anything because it is conditionally defined for IS_DLL whereas you're not using that directive in your code. You're using DRVUTIL_EXPORTS. I changed the preprocessor directive settings to define IS_DLL so the DLLEXPORT macro works.

    5) You put your extern "C" inside the header file but it needs to be on the function definition. So the updated definition is.

    extern "C" BOOL __declspec(dllexport)  IsUPSPresent()
    {
    ...
    }

    6) The return value in the C# code needs to be marked as MarshalAs.Bool otherwise it won't convert properly.

    [DllImport("drvutil.dll", CallingConvention = CallingConvention.Cdecl)]
    [return:MarshalAs(UnmanagedType.Bool)]        
    public static extern Boolean IsUPSPresent();

    After that, the code works.


    Michael Taylor http://www.michaeltaylorp3.net

    Monday, October 15, 2018 5:29 PM
    Moderator
  • Hi,

    Thank you for the detailed information.

    I followed your steps and made the changes.

    I am not clear about the below point:

    3) So this would work for me I modified the native project's build event to copy to the output directory of the ValidateUPS project so the DLL could be found.

    And for the above point, ValidateUPS project ->Build ->Output path is bydefault set as "bin\Debug\"

    Do we need to copy our unmanged dll to the output directory of the ValidateUPS project?

    Tuesday, October 16, 2018 4:16 AM
  • Hi,

    Still I am getting the same exception.

    System.DllNotFoundException:

    Tuesday, October 16, 2018 5:42 AM
  • Hi @CoolDadTx,

    I made all the changes inline with your comments. But still i am getting the same error 

    System.DllNotFoundException

    I am not sure what i have missed.

    Here I have given the link. In that link i have attached Managed and Unamanaged projects and also the project settings documents.

    Please let me know what i have missed.

    And also please share me the projects if they are working with your settings.

    https://1drv.ms/f/s!ApfxXg0ntrvwgRO6rdNl3bkuHbi8

    Regards,

    Satyaprakash

    Tuesday, October 16, 2018 9:50 AM
  • My running theory is the issue is that you are missing a dependency so your native DLL isn't loading. In your C++ code you're referencing another C++ project. Does that project produce a DLL? If so then that DLL needs to reside in the output directory next to your C++ DLL and both need to be copied into the output directory of your ValidateUPS project.

    That is what the build event I mentioned does. 

    copy "$(TargetPath)" "..\Install\Setup Files\compressed Files\Language Independent\Intel 32"
    copy "$(Configuration)\drvutil.lib" ..\common\libs
    
    echo This is the important stuff to copy into the C# project - assuming you may have other DLLs that need to be copied as well
    copy "$(TargetDir)*.dll" "$(SolutionDir)ValidateUPS\bin\$(Configuration)"
    copy "$(TargetDir)*.pdb" "$(SolutionDir)ValidateUPS\bin\$(Configuration)"
    

    Your .DEF file is gone so I removed it from the project.

    The code you keep posting won't compile. It references code we don't have so there is no way to help you with this. I keep stripping it down to just the drvutil file. Because nothing else is available the amount of changes to your project to get just that one file to work is high. Hence I rip everything out which may be impacting the behavior I'm seeing vs yours. But with just a drv.cpp your project will be properly loaded into the C# process and run. Here's what I have.

    //drvutil.h
    #ifndef _APC_DRVUTIL_HEADER_
    #define _APC_DRVUTIL_HEADER_
    
    #ifdef IS_DLL
       #define DLLEXPORT __declspec(dllexport)
    #else 
       #define DLLEXPORT
    #endif
    
    //This is the important part - expose as C function to avoid mangling and ensure it is exported
    extern "C" {
    BOOL DLLEXPORT IsUPSPresent();
    } // extern C
    
    #endif
    
    //drvutil.cpp
    // drvutil.cpp : Defines the entry point for the DLL application.
    //
    // rfallon 04Apr2001: Took out newdev.lib dependency. See commentary.
    
    #include <windows.h>
    #include <setupapi.h> // for SetupDiXxx functions.
    #include <tchar.h>
    #include <memory>
    #pragma hdrstop
    
    //Need this for the DLLEXPORT macro
    #include "drvutil.h"
    
    /*
    Routine Description:
    
        The function will check to see if an APC UPS device is present before we 
        try to disable Native Power Management
    
    Arguments:
    
        Nothing.
    
    Return Value:
    
        TRUE is returned if there is an APC UPS Device present, otherwise FALSE
        
    */
    
    //Export as C function
    extern "C"  BOOL DLLEXPORT IsUPSPresent()
    //BOOL IsUPSPresent()
    {
        //Just return a value
        return TRUE;
    }

    So here's where I'm going with all this. Are you sure your C++ project is even compiling? Is it even going to the correct path you think it is? Go into Windows Explorer and completely delete the bin and obj directories from your projects. Then rebuild. Then go back into ValidateUPS and verify all the binaries are there. If any are missing then you'll get the error you're seeing. You need to fix this otherwise nothing works.



    Michael Taylor http://www.michaeltaylorp3.net

    • Marked as answer by Satyaprakash A Wednesday, October 17, 2018 10:15 AM
    Tuesday, October 16, 2018 2:57 PM
    Moderator
  • Hi @CoolDadTx,

    Thank you for your time and the valuable information.

    Now after reading your explanation, i verified my solution settings and found that in my drvutil.dll (C++ project), I am referencing some other C++ projects like (upsdevice, and upscontrol)  those are also producing DLLs. But I am not copying those DLLs into the ValidateUPS project.

    As per your suggestion, I think I need to copy those dlls (upsdevice, and upscontrol) to ValidateUPS C# project.

    Do we need to copy those dlls (upsdevice, and upscontrol) to the C++ dll (drvutil.dll) as well?

    As mentioned above my Drvutil.dll project settings has "upsdevice" and "upscontrol" dlls in the below places:

    In the Configuration Properties of "drvutil.dll project" -> C/C++ -> General -> Additional Include Directories

    It was given "..\common\includes;..\upsdevice;..\upscontrol

    And also in 

    Linker -> General -> Additional Library Directories

    It was given "..\upscontrol\Debug;"

    To copy to the output directory of the "ValidateUPS" project, I copied .dll and .lib. Do I need to copy the .pdb as well?

    copy "$(TargetDir)*.pdb" "$(SolutionDir)ValidateUPS\bin\$(Configuration)"

    Yes, My project is compiling. That is actually misguiding me. If it throws compilation errors it is easy to understand. In my case it is compiling fine. I don't know might be my project settings are wrong. And also don't know is it going to the correct path or not? As you suggested, i will delete the bin and obj directories from my projects and then rebuild. But I am not sure whether my settings are correct or not.

    If you have time please go through the settings I made to my drvutil.dll project and give your valuable feedback. Similarly I made it for the the other projects as well.

    In the below link i attached the word document that has the drvutil.dll project settings screenshots.


    https://1drv.ms/w/s!ApfxXg0ntrvwgRaew_GarkJipj4W

    Once again thank you very much for your valuable information. It really helped me to understand the error.

    Tuesday, October 16, 2018 4:35 PM
  • "As per your suggestion, I think I need to copy those dlls (upsdevice, and upscontrol) to ValidateUPS C# project."

    Yes. That will cause the drvutil DLL not to load if it has dependencies it cannot load.

    "Do we need to copy those dlls (upsdevice, and upscontrol) to the C++ dll (drvutil.dll) as well?"

    It isn't necessary for compilation but it would be if you tried to debug it (which you can't since it is a library). However the build event code I showed you copies all the DLLs from your drvutil output directory to the C# project. So if you did copy your dependent DLLs into the output of the drvutil project then they would get automatically copied to the C# project as well which would resolve your issue.

    "To copy to the output directory of the "ValidateUPS" project, I copied .dll and .lib. Do I need to copy the .pdb as well?"

    You only need to copy the DLL files to the C# project. You don't need the LIBs at all. You should copy the PDBs if you have them as well. That is what the build event I posted does as well.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, October 16, 2018 4:52 PM
    Moderator
  • Hi @CoolDadTx,

    Than you for the detailed information.

    As per your suggestion, I copied the build event code (copied upsdevice, and upscontrol dlls) to drvutil and validateups projects.

    with that i resolved the error. 

    It helped me a lot to proceed further.

    Wednesday, October 17, 2018 10:15 AM