Misdecompilation of a lazy initialization pattern
I maintainer di solito rispondono entro 1 giorno
@siegfriedpammer ci sta già lavorando.
Dal 16/11/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 20/100
Direzione di ricerca
The report is precise: the Release-mode IL for _func ?? (_func = DefFunc) decompiles as => DefFunc, so operations are dropped. First reproduce by building the snippet with dotnet build -c Release and decompiling the assembly, then compare the IL of Func against the decompiled C# to see which null-coalescing and assignment nodes disappear. The work then sits in ILSpy's decompiler transformation pipeline (ICSharpCode.Decompiler), where the delegate-typed ?? pattern is not recognized; done means the round-trip output keeps the read of and assignment to _func. Expect to read the existing transform/pattern-matching stages before changing anything, and add a regression test case for this pattern.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A specific combination of delegates, null-coalescing operator, assignment expression and compiling in Release configuration causes decompiler to lose some operations. This pattern seems to be broken only for delegates. It is not limited to getters as in example below, the pattern is broken in general.
Input code
Compiled with dotnet build -c Release.
internal class Bug
{
private Action _func;
public Action Func => _func ?? (_func = DefFunc);
private void DefFunc() {}
}
Erroneous output
internal class Bug
{
private Action _func;
public Action Func => DefFunc;
private void DefFunc()
{
}
}
Func is decompiled without null-coalescing read from or assignment to _func.
Details
- ILSpy version: 11.2.0.10050+c86190ef4e24f3137c13a9275316042842d2fada
- Dotnet SDK: 10.0.401
- 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
-
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
-
Enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
icsharpcode/ILSpy#4298 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di icsharpcode/ILSpy
Issue simili
-
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