Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETunnelProvider.HandleAppMessage() method signature does not match underlying Obj-C Implementation #16789

Open
stanger opened this issue Nov 16, 2022 · 0 comments
Assignees
Labels
good first issue This is a good first issue for someone to start working with our code
Milestone

Comments

@stanger
Copy link

stanger commented Nov 16, 2022

Steps to Reproduce

  1. Implement the method as defined in networkextension.cs
  2. Attempt to pass a null value to the completion handler.

Expected Behavior

Null values should be able to be passed to the completion handler. This is implied in the Obj-C declaration, but is explicit in the swift declaration.

func handleAppMessage(
    _ messageData: Data,
    completionHandler: ((Data?) -> Void)? = nil
)

Actual Behavior

If implement as defined in the C# NETunnelProvider interface null values are not allowed to be passed to the competition handler.
This can be worked around by modifying the overridden method signature (below) to allow null values to be passed, but this results in a compiler warning.

public override void HandleAppMessage(NSData messageData, Action<NSData?>? completionHandler)
{
}

Environment

Version information
Visual Studio for Mac
17.5 Preview (17.5 build 437)

Build Logs

<redacted>/PacketTunnelProvider.cs(91,26): warning CS8610: Nullability of reference types in type of parameter 'completionHandler' doesn't match overridden member. [<redacted>.csproj::TargetFramework=net7.0-ios]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This is a good first issue for someone to start working with our code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants