Skip to content

Conversation

@walterlv
Copy link
Member

No description provided.

Copy link

Copilot AI left a 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.

Comment on lines +8 to +10
private readonly TaskCompletionSource _source = new TaskCompletionSource();
private readonly IRemoteFakeIpcArgumentOrReturn _privateReturn = new RemoteIpcReturn("private");

Copy link

Copilot AI Oct 28, 2025

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.

Suggested change
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();
}

Copilot uses AI. Check for mistakes.
/// 仅供 <see cref="GeneratedIpcProxy"/> 的自动生成的派生类与基类传递参数使用,包含参数传递所需的各种个性化需求。
/// </summary>
protected readonly record struct IpcMemberInfo
protected struct IpcMemberInfo
Copy link

Copilot AI Oct 28, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +141 to +142
() => new global::{ipc.GetNamespace()}.__{ipc.IpcType.Name}IpcProxy(),
() => new global::{ipc.GetNamespace()}.__{ipc.IpcType.Name}IpcJoint());
Copy link

Copilot AI Oct 28, 2025

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.

Copilot uses AI. Check for mistakes.
@walterlv walterlv changed the title 特供版,支持到 C#7.3 「特供版」支持到 C#7.3 - 保留此 PR 以供未来更新 Nov 7, 2025
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.

3 participants