Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8262589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:48:12+00:00 2026-06-08T03:48:12+00:00

On my local machine, Windows XP Ports (COM & LPT) COM3 RIM Virtual Serial

  • 0

On my local machine,

  • Windows XP
  • Ports (COM & LPT)
    • COM3
    • RIM Virtual Serial Port v2 (COM4)
    • RIM Virtual Serial Port v2 (COM5)

the following code,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
using System.Threading;

namespace OpenSerialPortTest
{
    class Test
    {
        static void Main(string[] args)
        {
            foreach (String serialPortName in SerialPort.GetPortNames())
            {
                SerialPort serialPort = new SerialPort(serialPortName);
                try
                {
                    serialPort.Open(); // Line 19
                    Console.WriteLine(serialPort.PortName);
                }
                catch (Exception ex1)
                {
                    Console.WriteLine(ex1);
                    try
                    {
                        serialPort.Close();
                    }
                    catch (Exception ex2)
                    {
                        Console.WriteLine(ex2);   
                    }
                }
            }
            Console.ReadLine();
        }
    }
}

will throw the following ArgumentException,

enter image description here

That is,

The given port name does not start with COM/com or does not resolve to
a valid serial port.

Does anybody know why this is happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:48:13+00:00Added an answer on June 8, 2026 at 3:48 am

    have a look at
    http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/35954173-2eeb-46af-bb3e-86840c6b5484

    seems the problem was that those COM ports were mapped to something else and gives this strange error in response.

    I had exactly the same problem. I found that I had a windows printer setup to use the same port. As soon as I changed the port in the printers settings, the SerialPort.Open() worked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to instal in SVN repository server on Windows local Machine.?
I built a windows service on my local machine. when I install and run
I have my intranet app with windows authentication. On my local machine I run
I've installed Apache 2.2 on a Windows machine for use in PHP local coding
I have a WCF service hosted on my local machine as windows service. Now
I'm using PIL 1.1.6 to render a truetype font on my local Windows machine.
I'm having a problem binding my websites on my local windows 7 machine. When
I am using Windows XP and some serial ports. I had never had any
I'm looking for a robust way to list the available serial (COM) ports on
I am developing using a Windows 7 machine with the local server being UniServer.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.