|
| 1 | +--- |
| 2 | +name: ef-triage |
| 3 | +description: Triages an incoming EF bug report, attempting to arrive at a minimal repro reproducing the bug, checking whether it represents a regression, finding possible duplicates, etc. |
| 4 | +--- |
| 5 | + |
| 6 | +# Update Pipeline |
| 7 | + |
| 8 | +Your are an agent helping to triage and reproduce incoming issues on the Entity Framework Core repository; your task is to read the issue in question (listed at the bottom, as well as any linked issues/code/resources, and to try to arrive at a minimal repro. User-submitted issues frequently provide only fragmentary information and code snippets, forcing you to try to fill in the missing information in the effort to create a minimal repro; valuable information is frequently provided in free-form text, which you need to integrate into the repro as code. |
| 9 | + |
| 10 | +## Reproducing the error |
| 11 | + |
| 12 | +The minimal repro should be created as a completely separate console program, outside of the EF repo. Use the following as your starting point: |
| 13 | + |
| 14 | +```c# |
| 15 | +using System; |
| 16 | +using System.Collections.Generic; |
| 17 | +using System.ComponentModel.DataAnnotations.Schema; |
| 18 | +using System.Diagnostics; |
| 19 | +using System.Linq; |
| 20 | +using System.Threading.Tasks; |
| 21 | +using Microsoft.EntityFrameworkCore; |
| 22 | +using Microsoft.Extensions.Logging; |
| 23 | + |
| 24 | +await using var context = new TestContext(); |
| 25 | +await context.Database.EnsureDeletedAsync(); |
| 26 | +await context.Database.EnsureCreatedAsync(); |
| 27 | + |
| 28 | +public class TestContext : DbContext |
| 29 | +{ |
| 30 | + public DbSet<Blog> Blogs { get; set; } |
| 31 | + |
| 32 | + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
| 33 | + => optionsBuilder |
| 34 | + // Modify to following line to switch EF providers |
| 35 | + .UseSqlServer("Server=localhost;Database=test;User=SA;Password=Abcd5678;Connect Timeout=60;ConnectRetryCount=0;Encrypt=false") |
| 36 | + .LogTo(Console.WriteLine, LogLevel.Information) |
| 37 | + .EnableSensitiveDataLogging(); |
| 38 | + |
| 39 | + protected override void OnModelCreating(ModelBuilder modelBuilder) |
| 40 | + { |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +public class Blog |
| 45 | +{ |
| 46 | + public int Id { get; set; } |
| 47 | + public string Name { get; set; } |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +* Try to integrate the user's code into the minimal template, incorporating any textual instructions from the issue, or clues that you can glean. |
| 52 | +* Pay attention to the EF provider being used (SQL Server, Npgsql...), and make sure to build your repro on the same provider and version that the user is reporting (as behavior may change across versions). |
| 53 | + * If you've managed to repro a problem on a provider other than SQL Server, please attempt to reproduce the same bug on SQL Server, as that's the easiest built-in provider to diagnose/debug on. When doing this, you need to see the same error/exception on SQL Server as on the non-SQL Server provider, otherwise that may be showing a different issue. |
| 54 | + * This would also confirm whether the but is specific to e.g. the PostgreSQL provider, or a general EF Core bug. |
| 55 | + * Once you've pinned down a provider to repro on (ideally SQL Server), do not keep code for multiple providers - the repro should only have code to repro on a single provider. |
| 56 | +* If you are unable to produce a standalone repro based on the user issue, please produce a console program that's as close as possible to what the user is describing, so that this attempted (failed) repro can be posted to the issue. |
| 57 | + * The program should use the same provider as what the user is reporting, and the exact same version. |
| 58 | + * The program should use code that's as close as possible to the user-reported code, including type/property naming and things that seem irrelevant. |
| 59 | + * Formulate a request that the user complete tweak your attempted repro to show it failing, providing any additional relevant questions on missing info that the user may provide. |
| 60 | + |
| 61 | +## Make the repro as minimal as possible |
| 62 | + |
| 63 | +Once you've managed to reproduce the bug, work to make the repro as minimal as possible, removing any code that isn't absolutely necessary to triggering the bug: |
| 64 | + |
| 65 | +* If the repro includes a LINQ query, try to remove any irrelevant LINQ operators from that query, as long as the error continues to reproduce. |
| 66 | +* If the repro makes use of Automapper, attempt to remove it, reproducing the raw LINQ query which Automapper produces. |
| 67 | +* If the repro is a query translation issue and does not actually require seed data to reproduce, remove any seeding as well, keeping only the query. |
| 68 | +* Do not include any non-necessary Console.WriteLine, banners, comments, summaries or other long-form text inside the code to explain what's going on. Add minimal one-line comments at most, and only where they're really necessary to follow a complicated flow or document results of calls; otherwise no comments are necessary. |
| 69 | +* Do not encapsulate code in functions unless really necessary - prefer a simple, minimal function-less program with only top-level statements. |
| 70 | +* Do not catch exceptions in order to convert them to a friendlier message; just allow them to bubble up and terminate the program. |
| 71 | +* However, leave the LogTo code that ensures that SQL gets logged to the database. |
| 72 | +* Do DbContext configuration within the OnConfiguring method of the DbContext type, rather than building the options externally and passing them to the constructor. Avoid any sort of DI unless it's necessary to reproducing the bug. |
| 73 | +* In general, the less lines of code, the better. |
| 74 | + |
| 75 | +## Post-repro steps |
| 76 | + |
| 77 | +* If you've managed to confirm a bug in your repro and the user claims they are reporting a regression, please test your repro on both the failing version and the previous working version, to confirm that it's indeed a regression. Provide clear feedback confirming or refuting the fact that the reported issue is a regression. |
| 78 | +* If you've managed to confirm a bug, please try to find possible duplicate issues - opened or closed - in the EF Core repo (https://github.com/dotnet/efcore), and post some candidates. |
| 79 | + |
| 80 | +## Posting your findings |
| 81 | + |
| 82 | +* Post your findings on the triaged issue as a comment. |
| 83 | +* The comment should being with a first-level heading with the text "AI Triage", followed by the sentence "The below is an AI-generated analysis and may contain inaccuracies." |
| 84 | +* The minimal repro console program should be contains within the posted comment, wrapped inside a collapsible HTML `<details>` block, to not take enough space (the summary should be "minimal repro"). |
| 85 | +* In your response, make sure that all links to issues, pull requests or source files are to the repo on github.com, and not local `vscode://` links, as your answer will be posted online. |
0 commit comments