-
Notifications
You must be signed in to change notification settings - Fork 30
「特供版」支持到 C#7.3 - 保留此 PR 以供未来更新 #187
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR downgrades the test project to support C# 7.3, making it a "special version" for older C# language compatibility. The changes remove modern C# features and adjust the codebase to work with C# 7.3 syntax requirements.
Key Changes:
- Downgraded C# language version from 11.0 to 7.3 in the test project
- Replaced file-scoped namespaces with traditional block-scoped namespaces across all files
- Converted C# 9.0+ record types to structs compatible with C# 7.3
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/dotnetCampus.Ipc.FakeTests/dotnetCampus.Ipc.FakeTests.csproj | Downgraded LangVersion to 7.3, disabled nullable and implicit usings, removed package references |
| tests/dotnetCampus.Ipc.FakeTests/Program.cs | Converted to block-scoped namespace, commented out main logic, added explicit using statements |
| tests/dotnetCampus.Ipc.FakeTests/FakeApis/*.cs | Converted file-scoped namespaces to block-scoped, added explicit using statements |
| src/dotnetCampus.Ipc/CompilerServices/GeneratedProxies/Models/IpcMemberInfo.cs | Converted record struct to regular struct, changed init-only properties to settable, removed readonly modifiers |
| src/dotnetCampus.Ipc.Analyzers/Generators/Utils/GeneratorHelper.cs | Disabled file-scoped namespaces in code generation, removed static lambda modifiers, commented out module initializer code |
| src/dotnetCampus.Ipc.Analyzers/CodeAnalysis/Models/IpcPublicAttributeNamedValues.cs | Added explicit type name to object initializer for C# 7.3 compatibility |
| Directory.Packages.props | Updated DotNetCampus.CodeAnalysisUtils from 0.0.1-alpha.5 to 0.0.1-alpha.6 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private readonly TaskCompletionSource _source = new TaskCompletionSource(); | ||
| private readonly IRemoteFakeIpcArgumentOrReturn _privateReturn = new RemoteIpcReturn("private"); | ||
|
|
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field _source is marked as readonly but TaskCompletionSource is a reference type. In C# 7.3, to properly support the readonly semantics with initialization, consider if this field truly needs to be readonly or if it should be initialized in a constructor instead of inline initialization.
| private readonly TaskCompletionSource _source = new TaskCompletionSource(); | |
| private readonly IRemoteFakeIpcArgumentOrReturn _privateReturn = new RemoteIpcReturn("private"); | |
| private readonly TaskCompletionSource _source; | |
| private readonly IRemoteFakeIpcArgumentOrReturn _privateReturn = new RemoteIpcReturn("private"); | |
| public RemoteFakeIpcObject() | |
| { | |
| _source = new TaskCompletionSource(); | |
| } |
| /// 仅供 <see cref="GeneratedIpcProxy"/> 的自动生成的派生类与基类传递参数使用,包含参数传递所需的各种个性化需求。 | ||
| /// </summary> | ||
| protected readonly record struct IpcMemberInfo | ||
| protected struct IpcMemberInfo |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting from readonly record struct to struct removes immutability guarantees. Since the fields _timeoutValue and _booleans are no longer readonly and properties now have set accessors instead of init, this struct is now mutable. This could lead to unexpected behavior if instances are modified after creation. Consider documenting this change in mutability or implementing defensive copying where this struct is used.
| () => new global::{ipc.GetNamespace()}.__{ipc.IpcType.Name}IpcProxy(), | ||
| () => new global::{ipc.GetNamespace()}.__{ipc.IpcType.Name}IpcJoint()); |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The static keyword was removed from lambda expressions. In C# 7.3, the static modifier for lambdas doesn't exist, so this change is necessary. However, this means these lambdas can now capture variables from the enclosing scope, potentially causing unintended allocations. Ensure these lambdas don't accidentally capture any variables.
No description provided.