Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using runtime checks instead of multi-targeting specific Unix distros in System.IO.Ports #54556

Closed
ViktorHofer opened this issue Jun 22, 2021 · 1 comment · Fixed by #54544
Assignees
Milestone

Comments

@ViktorHofer
Copy link
Member

ViktorHofer commented Jun 22, 2021

System.IO.Ports currently targets Linux, OSX and FreeBSD even though their implementation is 95% identical. To reduce package size and build times runtime checks could be used for the 5% diverging functionality:

<ItemGroup Condition="'$(TargetsLinux)' == 'true'">
<Compile Include="System\IO\Ports\SerialPort.Linux.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' ">
<Compile Include="System\IO\Ports\SerialPort.OSX.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsFreeBSD)' == 'true' ">
<Compile Include="System\IO\Ports\SerialPort.FreeBSD.cs" />
</ItemGroup>

As an example, when adding NetCoreAppCurrent configurations, the package grows disproportionally because of the amount of runtime specific assemblies.

cc @adamsitnik @carlossanlop @jozkee @jeffhandley @ericstj

@ghost
Copy link

ghost commented Jun 22, 2021

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

System.IO.Ports currently targets Linux, OSX and FreeBSD even though their implementation is 95% identical. To reduce package size and build times runtime checks could be used for the 5% diverging functionality:

<ItemGroup Condition="'$(TargetsLinux)' == 'true'">
<Compile Include="System\IO\Ports\SerialPort.Linux.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' ">
<Compile Include="System\IO\Ports\SerialPort.OSX.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsFreeBSD)' == 'true' ">
<Compile Include="System\IO\Ports\SerialPort.FreeBSD.cs" />
</ItemGroup>
.

cc @adamsitnik @carlossanlop @jozkee @jeffhandley @ericstj

Author: ViktorHofer
Assignees: -
Labels:

area-System.IO

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jun 22, 2021
@ViktorHofer ViktorHofer self-assigned this Jun 22, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 22, 2021
@adamsitnik adamsitnik removed the untriaged New issue has not been triaged by the area owner label Jun 25, 2021
@adamsitnik adamsitnik added this to the 6.0.0 milestone Jun 25, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 29, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants