Four await shapes decompile to uncompilable C#
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Comienza con los cuatro miembros que fallan en ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncAwaitPatternsBugs.cs, en la rama tests/async-await-patterns. Ejecuta los tests de async-await-patterns y luego inspecciona VisitAwait y el manejo de LdObjIfRef en ExpressionBuilder junto con los controles dynamic-call y record-with. La tarea estará terminada cuando los cuatro casos se decompilen a C# compilable y los tests del fixture pasen.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Four await shapes decompile to C# that does not compile. All four reproduce on
master @ 40e6f2cf2 and still reproduce after 257c96711 ("Avoid allowImplicitConversion: true
for await expressions"), which fixed a different set of await defects.
Each of them is covered by a member of ICSharpCode.Decompiler.Tests/TestCases/Pretty/AsyncAwaitPatternsBugs.cs
on the tests/async-await-patterns branch, where the fixture is written as the C# that should
come out; the test is red for exactly these four.
1. Extension GetAwaiter taking its receiver by in
public struct ByRefReceiver
{
public long A;
public long B;
public TaskAwaiter Self() => default(TaskAwaiter);
}
public static class ByRefExtensions
{
public static TaskAwaiter GetAwaiter(this in ByRefReceiver receiver) => receiver.Self();
}
public async Task InReceiverExtensionAwaiter(ByRefReceiver value)
{
await value;
}
decompiles to:
public unsafe async Task InReceiverExtensionAwaiter(ByRefReceiver value)
{
await (ref *(ByRefReceiver*)value);
}
error CS1525: Invalid expression term 'ref'. The method also acquires an unsafe modifier it
did not have. The in parameter makes the awaited expression's expected type a
ByReferenceType; VisitAwait strips the DirectionExpression off the operand before
converting it.
2. await on a type parameter constrained to an awaitable interface
public interface IAwaitable
{
TaskAwaiter GetAwaiter();
}
public async Task TypeParameterWithInterfaceConstraint<T>(T value) where T : IAwaitable
{
await value;
}
decompiles to:
await (IAwaitable)/*OpCode not supported: LdObjIfRef*/;
error CS0119: 'IAwaitable' is a type, which is not valid in the given context. The operand is
not merely wrong, it is dropped: the constrained. callvirt lowers to an LdObjIfRef that
ExpressionBuilder has no case for.
3. dynamic await inside the argument list of a static call
public async Task DynamicAwaitInStaticCall(dynamic value)
{
Console.WriteLine("x" + await value);
}
decompiles to:
Type typeFromHandle = typeof(Console);
typeFromHandle.WriteLine("x" + await value);
error CS1061: 'Type' does not contain a definition for 'WriteLine'. The call site's
typeof(TargetType) marker argument becomes the receiver. Isolated against two controls: the
same call without the await, and an instance dynamic call with an await, both decompile
correctly.
4. await inside a record with initializer
public record Record(int X);
public async Task<Record> WithExpressionContainingAwait(Record value)
{
return value with { X = await Get() };
}
decompiles to:
Record record = value._003CClone_003E_0024();
Record record2 = record;
record2.X = await Get();
return record;
which does not compile. Isolated against two controls: value with { X = 1 } and
value with { X = Compute() } both round-trip as with expressions, so the await is what
defeats the transform.
Posted by an AI agent (Claude) on Siegfried's behalf.
- 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
-
Misdecompilation of a lazy initialization patternPosiblemente ocupada @siegfriedpammer la tomó hace 5 días. AbiertoBug Decompiler
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
icsharpcode/ILSpy#4349 ·
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
Todos los issues de icsharpcode/ILSpy
Issues similares
-
DXF with empty names failsAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 3 días
-
bug python
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
ilia-sokolov/OfficeAgent.NET#89 ·
Los mantenedores suelen responder en 13 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
juandresrodca/AdminForge#66 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
umbraco/Umbraco.Automate#612 ·
Los mantenedores suelen responder en 1 día