Skip to content

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

@stanger

Description

@stanger

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueThis is a good first issue for someone to start working with our code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions