Bug 4543 - [PATCH] WinSerialStream constructor COM10+ fix
Summary: [PATCH] WinSerialStream constructor COM10+ fix
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 2.10.x
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-04-19 18:44 UTC by James Bellinger
Modified: 2012-04-29 18:54 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

serial patch (857 bytes, patch)
2012-04-19 18:44 UTC, James Bellinger

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description James Bellinger 2012-04-19 18:44:04 UTC
On Windows, COM ports 10 and above do not work.
This is because CreateFile is called without the \\.\ prefix.
\\.\ works for COM ports below 10 as well, so really it should always be added.

My patch, attached, does exactly this. It also checks if \\.\ has already been added and in that case does not add it. This is because myself and probably many other people have worked around Mono's bug by adding it manually in the past. So, this fixes the bug and preserves compatibility with older Mono for Windows programs.
Comment 1 James Bellinger 2012-04-19 18:44:32 UTC
Created attachment 1709 [details]
serial patch
Comment 2 Miguel de Icaza [MSFT] 2012-04-23 23:44:47 UTC
What version fo Mono is this against?   The code does not exist as is on Mono/master

Alternatively, could you submit this patch using github?
Comment 3 James Bellinger 2012-04-24 12:35:36 UTC
Oh, sorry. I did a diff against an earlier version of my own code by accident instead of a reference Mono version. I've sent the change over Github.
Comment 4 James Bellinger 2012-04-29 17:45:13 UTC
Sorry, forgot to update away from NEEDINFO. Anyway, it's sent over Github. Let me know if that's good.
Comment 5 James Bellinger 2012-04-29 18:54:01 UTC
Sorry, didn't realize it had already been merged. Bit new to Github :) Anyway, closing this.