MicrosoftEdge / MicrosoftEdge/WebView2Feedback

wv2winrt: null as string function parameter value becomes string "null"

Open
#3,145 1 comment 0 reactions 1 assignee View on GitHub

@david-risney is already working on this.

Since Jan 23, 2023.

bug priority-low tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description

Consider WebView2 sample app's AddHostObject example - https://github.com/MicrosoftEdge/WebView2Samples/blob/main/SampleApps/webview2_sample_uwp/Pages/AddHostObject.xaml.cs

I updated the code in add_host_object.html to change AddToList function as follows

        function AddToList(button) {
            let text = button.innerHTML;
            bridgeInstance.async().appendToItems(null);
        }

But the value that I received in Bridge class AppendToItems is "null" i.e. string containing letters n u l l instead of null

Version
SDK: e.g. 1.0.1518.46
Framework: UWP
OS: Win11

Repro Steps

  1. Add a break point in the Bridge.AppendToItems function at the start
  2. Run the sample app in debug mode
  3. Go to AddHostObject example
  4. Click on Lion

The expected value of item = null
Actual value of item - "null"

Screenshots
image

Additional context
Note that if I use a int? instead of string it is able to recognize it as null as expected

AB#43066540

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.