Skip to content

[dotnet] Removed {{separator}} token from C# filename codegen #13237

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

Merged
merged 2 commits into from
Dec 5, 2023
Merged

[dotnet] Removed {{separator}} token from C# filename codegen #13237

merged 2 commits into from
Dec 5, 2023

Conversation

EdwinVanVliet
Copy link
Contributor

@EdwinVanVliet EdwinVanVliet commented Dec 4, 2023

Description

On our own build environment we noticed that the intermediate files being generated when running the codegen contain the {{separator}} token. When looking into the Utility.cs ReplaceTokensInPath function there is no replacement being done on the {{separator}} token. This PR removes the {{separator}} token from the template within CodeGenerationDefinitionTemplateSettings.cs causing filenames to be outputted without {{separator}}.

Also this issue caused some files to end up in the wrong directory. The AXPropertyName.cs should be located in the Accesibility domain, but it ended up in WebAuthn.

Before fix.
SeparatorIssue

After fix.
SeparatorIssueFixed

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…f Accesibility{{separator}}AXPropertyName.cs for instance.
@titusfortner titusfortner added the C-dotnet .NET Bindings label Dec 4, 2023
@nvborisenko
Copy link
Member

Somebody introduced {{separator}} token. I don't know why, but let's not break this logic.

I propose very simple fix:
Utility.cs

path = path.Replace("{{separator}}", System.IO.Path.DirectorySeparatorChar.ToString());

If it works, then we also can remove the following line:

path = path.Replace('\\', System.IO.Path.DirectorySeparatorChar);

Seems somebody also tried to fix the same thing around path separator token.

Copy link
Member

@nvborisenko nvborisenko left a comment

Choose a reason for hiding this comment

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

We still need to support {{separator}} token. Let's replace it in runtime.

@nvborisenko
Copy link
Member

Seems it works, please doble-check carefully:

- path = path.Replace('\\', System.IO.Path.DirectorySeparatorChar);
+ path = path.Replace("{{separator}}", System.IO.Path.DirectorySeparatorChar.ToString());
+ //path = path.Replace('\\', System.IO.Path.DirectorySeparatorChar);

@EdwinVanVliet
Copy link
Contributor Author

@nvborisenko

That also works, confirmed with our build environment. Committed the changes.

We both need the {{separator}} and \\ replacements because CodeGenerationDefinitionTemplateSettings.cs contains both forms.

@codecov-commenter
Copy link

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (eb0a321) 57.52% compared to head (aeeaa69) 57.95%.
Report is 54 commits behind head on trunk.

❗ Current head aeeaa69 differs from pull request most recent head 1141b4a. Consider uploading reports for the commit 1141b4a to get more accurate results

Files Patch % Lines
py/selenium/webdriver/common/bidi/cdp.py 0.00% 4 Missing ⚠️
py/selenium/webdriver/safari/webdriver.py 50.00% 3 Missing ⚠️
py/selenium/webdriver/chromium/webdriver.py 83.33% 1 Missing and 1 partial ⚠️
py/selenium/webdriver/firefox/remote_connection.py 0.00% 1 Missing ⚠️
py/selenium/webdriver/firefox/webdriver.py 83.33% 1 Missing ⚠️
py/selenium/webdriver/ie/webdriver.py 87.50% 1 Missing ⚠️
py/selenium/webdriver/remote/webdriver.py 66.66% 1 Missing ⚠️
py/selenium/webdriver/remote/webelement.py 50.00% 1 Missing ⚠️
py/selenium/webdriver/safari/service.py 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #13237      +/-   ##
==========================================
+ Coverage   57.52%   57.95%   +0.43%     
==========================================
  Files          86       88       +2     
  Lines        5299     5333      +34     
  Branches      221      224       +3     
==========================================
+ Hits         3048     3091      +43     
+ Misses       2030     2018      -12     
- Partials      221      224       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nvborisenko nvborisenko changed the title [.NET] Removed {{separator}} token from C# filename codegen [dotnet] Removed {{separator}} token from C# filename codegen Dec 5, 2023
@nvborisenko
Copy link
Member

Thanks @EdwinVanVliet for your contribution!

@nvborisenko nvborisenko merged commit 999e583 into SeleniumHQ:trunk Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-dotnet .NET Bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants