Normally I would suggest leaving a comment in the appropriate forum -
Get Physical HDD Serial Number without WMI[
^] but dmihailescu hasn't been active on the site since 2017.
Try removing the reference to DriveInfoEx from your solution and then copy the DLL to your solution folder or a sub-folder. Add a reference to that copy into into your solution.
The code you have posted doesn't appear to have anything to do with the problem as there is nothing in there that refers to DriveInfo, HDD, or Serial Numbers. So perhaps find the code that is referring to it and remove the code if you don't need it.
And please heed @MadMyche's comment about using an out-of-date driver - it looks as if you have found some code to download and are just using it "as is" without understanding what it is actually doing.