Serial port detection libraries are taking more time than usual while having the serial over Bluetooth port enabled under device manager ports section. I'm using ManagementObjectSearcher for detecting the com ports in our C# code.
Serial port detection libraries are taking more time than usual while having the serial over Bluetooth port enabled under device manager ports section. I'm using ManagementObjectSearcher for detecting the com ports in our C# code.
Hi @AnishV-0241,
It may be related to the virtual port.
You can try to check the hidden serial ports in Device Manage via following steps:
1.Run Device Manager from elevated command line:
> set DEVMGR_SHOW_NONPRESENT_DEVICES=1
> devmgmt.msc
2.Enable "Show hidden devices" in the menu, and uninstall grayed-out COM ports.
>>I'm using ManagementObjectSearcher for detecting the com ports in our C# code.
Could you please more related code to find the problem?
Best Regards,
Daniel Zhang
Please find the below code snippet from my code:
ManagementObjectSearcher comPortSearcher = new ManagementObjectSearcher(@"root\cimv2", @"SELECT * FROM Win32_SerialPort");
List<string> portNames = new List<string>();
ObservableCollection<string> comPorts = new ObservableCollection<string>();
try
{
using (comPortSearcher)
{
string caption = null;
foreach (ManagementObject obj in comPortSearcher.Get())
{
if (obj != null)
{
object captionObj = obj["Caption"];
if (captionObj != null)
{
caption = captionObj.ToString();
if (caption.Contains("(COM"))
{
portNames.Add(caption);
}
}
}
}
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
8 people are following this question.
Insert a node as child ,before or after a node in nested dynamic JSON Node using C#
Visual Studio 2019: Undefined behavior in a C++/CLI wrapper project.
Example for how to get Package Metadata from Azure DevOps Rest-Api Artifacts using c#
How to collapse individual nested grids/stackpanels inside a grid?