Sequence points can land in the middle of an IL instruction
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 74/100
Direzione di ricerca
Inizia da ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs, in SequencePointBuilder.GetSequencePoints, quindi confronta la gestione degli offset con SequencePointCandidates in ILReader.cs intorno alla riga 560. Riproduci il problema con il codice sorgente C# fornito usando dotnet build -c Release e ilspycmd -genpdb; il lavoro è completato quando i punti di sequenza generati ricadono in modo coerente su offset di inizio istruzione, inclusi i casi visibili e nascosti segnalati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Sequence points in a generated PDB can carry an IL offset that is not the start of an instruction. A consumer that resolves such an offset to an instruction gets nothing back: Mono.Cecil's GetInstruction returns null, and a debugger asked to bind a breakpoint there has no instruction to bind to.
Only visible in assemblies compiled in Release. In a Debug build the first instruction of every method is a one-byte nop, which happens to make the offending offset land on a boundary.
Reproduction
using System;
namespace ProbeNs
{
public struct Holder
{
public int Value;
}
public class Minimal
{
public static int UseDefault(int input)
{
Holder holder = default(Holder);
holder.Value = input;
return holder.Value;
}
public static Func<int, int> MakeDelegate(int offset)
{
return (int n) => n + offset;
}
}
}
dotnet build -c Release
ilspycmd -genpdb Probe.dll
Minimal.UseDefault: sequence point at IL_0001 (hidden) is inside IL_0000: ldloca.s (2 bytes)
Minimal.MakeDelegate: sequence point at IL_0001 (hidden) is inside IL_0000: newobj (5 bytes)
The same source built in Debug produces no such point.
The full point list for one of them shows the shape - a one-byte first point, and the hidden filler that follows it inherits its end offset:
off=0x0 visible line=30
off=0x1 hidden <- inside the 5-byte instruction at IL_0000
off=0x14 visible line=31
off=0x23 hidden
off=0x29 visible line=32
Visible sequence points are affected too, not only hidden ones. In Microsoft.Extensions.Http 10.0.11, <<SendCoreAsync>g__Core|4_0>d.MoveNext gets a visible point for line 62 at IL_000b, inside the 5-byte ldfld at IL_0008.
Scale over shipping assemblies: 156 such points in Newtonsoft.Json 13.0.4, 21 in AutoMapper 16.2.0, 4 in Microsoft.Extensions.Http 10.0.11.
Context
In SequencePointBuilder.GetSequencePoints (ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs), the loop that snaps offsets to function.SequencePointCandidates adjusts EndOffset of the current point and Offset of the next one only when the neighbouring-point conditions hold; the gap-filling insert at the end of the loop body then takes currSequencePoint.EndOffset verbatim as the new point's Offset. SequencePointCandidates itself only ever contains inst.StartILOffset values (ILReader.cs line 560), so the candidate list is not the source of the bad offsets.
Posted by an AI agent (Claude) on Siegfried's behalf.
- Lingua principale
- C#
- Stelle
- 27.1k
- Fork
- 3.8k
- Merge medio
- 1g 23h
- PR unite (30g)
- 44
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di icsharpcode/ILSpy
-
AvaloniaEdit Issues to dateApertaExternal UI
Difficoltà 1/5 1-3 ore Idoneità per principianti 75/100
icsharpcode/ILSpy#4284 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
icsharpcode/ILSpy#4357 ·
I maintainer di solito rispondono entro 1 giorno
-
Misdecompilation of a lazy initialization patternForse già presa @siegfriedpammer l’ha presa 5 giorni fa. ApertaBug Decompiler
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
icsharpcode/ILSpy#4349 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
icsharpcode/ILSpy#4343 ·
I maintainer di solito rispondono entro 1 giorno
-
AI
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
icsharpcode/ILSpy#4300 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di icsharpcode/ILSpy
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
umbraco/Umbraco.Automate#612 ·
I maintainer di solito rispondono entro 1 giorno
-
崩溃日志只按 CRLF 分行Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PCL-Community/PCL-CE#3872 ·
I maintainer di solito rispondono entro 1 giorno
-
type:task ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
elsa-workflows/elsa-foundation#5253 ·
I maintainer di solito rispondono entro 1 giorno