AIDL CSharpCodeGenerator: oneway methods generate synchronous Proxy code
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 579
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 252
Description
### Summary
`Xamarin.Android.Tools.Aidl.CSharpCodeGenerator` does not honor AIDL method-level `oneway` semantics on the client (Proxy) side. For a method declared as:
```aidl
oneway void fireAndForget(int value);
```
the generated `Proxy` still:
1. Allocates a reply `Parcel` (`var __reply = Parcel.Obtain ();`),
2. Passes it to `Transact (...)`,
3. Calls `__reply.ReadException ()` after the transact returns.
True AIDL `oneway` semantics require:
- No reply parcel (pass `null`),
- The `FlagOneway` transact flag,
- No `ReadException` call (oneway calls cannot return exceptions to the caller).
The current behavior turns `oneway` into an effectively synchronous call and can block the caller until the remote side returns, defeating the purpose of `oneway`.
### Where
`src/Xamarin.Android.Tools.Aidl/CSharpCodeGenerator.cs` — Proxy method emission for methods with `IsOneway == true`.
### Repro / evidence
See the golden output snapshotted in `tests/Xamarin.Android.Tools.Aidl-Tests/TestData/OnewayMethods.txt` (added in #11460), which captures the current Proxy output for a `oneway` method.
### Notes
- Stub side already correctly skips `reply.WriteNoException ()` for `oneway` methods.
- A fix here is a behavior change for anyone consuming AIDL-generated code, so it likely needs a brief compat note.
- Related: #5011 (needs unit tests — addressed by #11460), #8735 (transaction IDs).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.