Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Annotate auto-generated code

Đang mở
#2,588 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
tooling

Hướng nghiên cứu

Start by locating the source generator that emits files such as Functions_Handle_Generated.g.cs and tracing how it builds the generated header and type declarations. Add the requested generated-code and coverage annotations to generated types and applicable members, and replace the header with the descriptive block shown in the issue. Verify generated output includes these annotations and header.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature-request needs-triage
Describe the feature

The source generator's output (e.g. Functions_Handle_Generated.g.cs) has no attributes that identify it as
generated code, and only the minimal // <auto-generated/> header. Please:

  1. Add [GeneratedCode("<tool>", "<version>")] to every generated type (and member where it applies).
  2. Replace the one-line header with the standard descriptive <auto-generated> block.
  3. Add [ExcludeFromCodeCoverage] to generated types.
Use Case

As a developer enforcing code-quality gates (coverage thresholds, static analysis) on Lambda projects,
I need the generated handler code to identify itself as generated ([GeneratedCode], [ExcludeFromCodeCoverage] and a full <auto-generated> header),
so that coverage and analysis tools exclude it automatically, without per-repository exclusion rules.

Today the generated *_Generated class is indistinguishable from hand-written code once compiled. It lowers
reported coverage, appears in analyzer and mutation-testing results, and cannot be annotated by the user. Each
repository has to maintain its own tool-specific exclusion.

Proposed Solution

Generated code is annotated with

  • <auto-generated> comment
  • GeneratedCode attribute
  • ExcludeFromCoverage attribute

Sample output:

// <auto-generated>
//     This code was generated by a tool (Amazon.Lambda.Annotations.SourceGenerator 2.4.1.0).
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>

using System;
...
namespace Acme.EventDistributor.Trigger
{
    /// <summary>
    /// The generated Lambda function handler for <see cref="Acme.EventDistributor.Trigger.Functions"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Amazon.Lambda.Annotations.SourceGenerator", "2.4.1.0")]
    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
    public class Functions_Handle_Generated
    {
Other Information

No response

Acknowledgements
  • I may be able to implement this feature request
  • This feature might incur a breaking change
AWS .NET SDK and/or Package version used

Amazon.Lambda.Annotations 2.4.1.0

Targeted .NET Platform

.NET SDK 10.0.401

Operating System and version

Windows 11

Ngôn ngữ chính
C#
Star
1.7k
Fork
505
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aws/aws-lambda-dotnet

Tất cả issue của aws/aws-lambda-dotnet

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.