Misdecompilation of a lazy initialization pattern
Los mantenedores suelen responder en 1 día
@siegfriedpammer ya está trabajando en esto.
Desde el 16/11/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 20/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- C#
- Estrellas
- 27.1k
- Forks
- 3.8k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 44
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de icsharpcode/ILSpy
-
AvaloniaEdit Issues to dateAbiertoExternal UI
Dificultad 1/5 1-3 horas Aptitud para principiantes 75/100
icsharpcode/ILSpy#4284 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
icsharpcode/ILSpy#4357 ·
Los mantenedores suelen responder en 1 día
-
Bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
icsharpcode/ILSpy#4343 ·
Los mantenedores suelen responder en 1 día
-
AI
Dificultad 4/5 1-2 días Aptitud para principiantes 55/100
icsharpcode/ILSpy#4300 ·
Los mantenedores suelen responder en 1 día
-
Enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
icsharpcode/ILSpy#4298 · 1 comentario · 2 reacciones ·
Los mantenedores suelen responder en 1 día
Todos los issues de icsharpcode/ILSpy
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
umbraco/Umbraco.Automate#612 ·
Los mantenedores suelen responder en 1 día
-
崩溃日志只按 CRLF 分行Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PCL-Community/PCL-CE#3872 ·
Los mantenedores suelen responder en 1 día
-
type:task ux
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
elsa-workflows/elsa-foundation#5253 ·
Los mantenedores suelen responder en 1 día