Conversation
Replaced use of deprecated CodeBase with Location (in tests)
andrew-polk
left a comment
There was a problem hiding this comment.
@andrew-polk reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @aror92 and @mark-sil).
src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs line 29 at r1 (raw file):
protected void TestSetup(string installedTranslationDir) { var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).LocalPath);
Looks fine and feel free to merge if you want, but devin review caught this:
CodeBase to Location migration is correct but creates codebase inconsistency
The change from Assembly.GetExecutingAssembly().CodeBase to Assembly.GetExecutingAssembly().Location at ILocalizableComponentTests.cs:29 is a valid modernization since CodeBase is obsolete in .NET 5+. The pattern new Uri(Location).LocalPath works because the Uri constructor recognizes absolute Windows file paths (like C:\path\to\assembly.dll) and converts them to file:// URIs internally.
However, this creates an inconsistency in the codebase - other test files still use the old CodeBase pattern:
- XLiffUtilsTests.cs:16 uses
Assembly.GetExecutingAssembly().CodeBase.Replace("file://", String.Empty) - LocalizationManagerXliffTests.cs:41 uses
new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath - XLiffSchemaValidationTests.cs:21 uses
new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath
These should likely be updated for consistency and to avoid obsolete API warnings when targeting .NET 5+.
Also minor code cleanup in TempFile.cs
andrew-polk
left a comment
There was a problem hiding this comment.
@andrew-polk reviewed 4 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @aror92 and @mark-sil).
Also updated copyright year to 2026 and replaced use of deprecated CodeBase with Location (in tests).
This change is