MatthewKing / DeviceId

A simple library providing functionality to generate a 'device ID' that can be used to uniquely identify a computer.
MIT License
794 stars 118 forks source link

Connection string property vanishes , @DeviceId.SqlServer #88

Closed SreeVardhanTulluri closed 4 months ago

SreeVardhanTulluri commented 5 months ago

I'm utilizing DeviceId to identify logs within my application. Initially, I successfully created a machine ID and other components using DeviceId.Windows. Later, I attempted to enhance this by incorporating the database connection ID whenever a user opens and subsequently closes a connection. However, when I call the function to retrieve the SqlConnectionId using the connection variable of type SqlConnection, its ConnectionString property is unexpectedly becoming null or empty."

Screenshot 2024-07-05 182152
SreeVardhanTulluri commented 5 months ago

Before calling above function image after calling above function image

MatthewKing commented 5 months ago

Thanks for the bug report. This should be fixed in 6.7.0, have a try and let me know how it goes. Cheers

iris-jen commented 4 months ago

I'm having the same issue with 6.7.0

Here the connection string is fine image

Then after the SQL connection call, the connection string disappears and the connection closes image

All Ids produced are the same as the result from the windows calls, I'm assuming it returns a GUID when the platform is incorrect. Im running this code in a docker container, so i would not expect the windows id's to be valid, but the SQL ones seem the same too

sqlDbId WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG sqlServerName WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG sqlDbName WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG

winProdId WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG winProcId WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG winMac WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG winSys WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG winMachineGuid WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG winSysDriveSn WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG

linuxProcId XW9EVPW00FXHKMCVVGB0EDGPX8TEYF4KT4YWR8KDPQ4DJ7PP3AX0 containerId W3RCVFNZTEWXST1KRQ8K737TK87H2EKYXW0R9FYN6XPR0T8QCVH0

Using the following versions image

MatthewKing commented 4 months ago

Hi, thanks for the report. Fixed in 6.7.1.