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

feat/csharp #16

Merged
merged 13 commits into from
Jul 18, 2023
Merged

feat/csharp #16

merged 13 commits into from
Jul 18, 2023

Conversation

John-Paul-R
Copy link
Collaborator

This should be a mostly 1:1 port of the java version


  • I own the full rights to my contribution, and agree to release it under the terms of the Creative Commons Zero Public Domain Dedication

@unascribed
Copy link
Owner

I'll try to compile and test this in Mono when I get a chance.

@John-Paul-R
Copy link
Collaborator Author

Do you have any particular preferences around how this gets published to NuGet? Figuring out that bit as I go atm.

Current state of the publish info: https://github.com/unascribed/FlexVer/blob/2e3b64c64157b6719b65399b634c24c93933536c/csharp/FlexVer/FlexVer.nuspec

@unascribed
Copy link
Owner

I know absolutely nothing about NuGet, so, not really anything I can add.

@unascribed
Copy link
Owner

Does not build for me:

Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 5/11/2023 10:15:12 AM.
Project "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|Any CPU".
Project "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer.sln" (1) is building "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer/FlexVer.csproj" (2) on node 1 (default targets).
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v7.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. [/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer/FlexVer.csproj]
_CleanRecordFileWrites:
  Creating directory "obj/Debug/net7.0/".
Done Building Project "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer/FlexVer.csproj" (default targets) -- FAILED.
Project "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer.sln" (1) is building "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVerTests/FlexVerTests.csproj" (3) on node 1 (default targets).
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v7.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. [/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVerTests/FlexVerTests.csproj]
_CleanRecordFileWrites:
  Creating directory "obj/Debug/net7.0/".
Done Building Project "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVerTests/FlexVerTests.csproj" (default targets) -- FAILED.
Done Building Project "/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer.sln" (default targets) -- FAILED.

Build FAILED.

"/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer.sln" (default target) (1) ->
"/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer/FlexVer.csproj" (default target) (2) ->
(GetReferenceAssemblyPaths target) -> 
  /usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v7.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. [/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer/FlexVer.csproj]


"/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVer.sln" (default target) (1) ->
"/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVerTests/FlexVerTests.csproj" (default target) (3) ->
  /usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v7.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. [/tmp/tmp.Wdct2JtOgi/FlexVer/csharp/FlexVerTests/FlexVerTests.csproj]

    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:00.45

Does Mono not support the version of .NET you've used? I know literally nothing about the .NET ecosystem, kinda out of my depth.

@unascribed
Copy link
Owner

$ mcs FlexVer/FlexVerComparer.cs
FlexVer/FlexVerComparer.cs(15,17): error CS1525: Unexpected symbol `;'
FlexVer/FlexVerComparer.cs(25,6): error CS1514: Unexpected symbol `public', expecting `.' or `{'
FlexVer/FlexVerComparer.cs(34,10): error CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 7.0 language specification
FlexVer/FlexVerComparer.cs(34,28): error CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 7.0 language specification
FlexVer/FlexVerComparer.cs(35,10): error CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 7.0 language specification
FlexVer/FlexVerComparer.cs(48,9): error CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 7.0 language specification
FlexVer/FlexVerComparer.cs(49,9): error CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 7.0 language specification
FlexVer/FlexVerComparer.cs(64,61): error CS1014: A get or set accessor expected
FlexVer/FlexVerComparer.cs(80,3): error CS0589: Internal compiler error during parsingSystem.InvalidCastException: Specified cast is not valid.
  at Mono.CSharp.CSharpParser.case_305 () [0x00015] in <798cc512ec0246288e0ea46d67959405>:0 
  at Mono.CSharp.CSharpParser.yyparse (Mono.CSharp.yyParser.yyInput yyLex) [0x02169] in <798cc512ec0246288e0ea46d67959405>:0 
  at Mono.CSharp.CSharpParser.parse () [0x00028] in <798cc512ec0246288e0ea46d67959405>:0 
Compilation failed: 9 error(s), 0 warnings

Guess it doesn't.

I'll just merge this if you say it works, then. I don't have any Windows systems around.

@John-Paul-R
Copy link
Collaborator Author

I've been using MS's dotnet distributions on linux (instead of Mono) without issue for a while now. If you want to get that running, AUR has it, and here are the MS 'dotnet on linux' docs.

I have verified that the tests pass on my machine, though, yes.

I can set up a build & test github action for this pretty easily for verification. Lmk if you think that'd fit here, and I'll push an update to this PR!

@unascribed
Copy link
Owner

I like for all of the implementations to have an Actions workflow that verifies the tests pass, so that would be a nice thing to add.

* Use ReadOnlySpan to make RemoveLeadingZeroes non-allocating

* add test-csharp.yml

* specify cwd in action
@John-Paul-R
Copy link
Collaborator Author

GH Action added!

Copy link
Owner

@unascribed unascribed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I took so long to review this — LGTM and works fine with .NET Core.

@unascribed unascribed merged commit adad4fa into unascribed:trunk Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants