MicrosoftEdge / MicrosoftEdge/WebView2Feedback
WebView2.Source property throws NotImplementedException when passed a null value
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
This seems like the incorrect exception type for this error. Perhaps an ArgumentNullException or InvalidOperationException would be more appropriate.
private static void SourcePropertyChanged(
DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
Microsoft.Web.WebView2.Wpf.WebView2 control = (Microsoft.Web.WebView2.Wpf.WebView2) d;
if (control.IsPropertyChangingFromCore(Microsoft.Web.WebView2.Wpf.WebView2.SourceProperty))
return;
Uri oldValue = (Uri) e.OldValue;
Uri newValue = (Uri) e.NewValue;
if (newValue == (Uri) null)
throw new NotImplementedException("The Source property cannot be set to null.");
if (!newValue.IsAbsoluteUri)
throw new ArgumentException("The Source property cannot be set to a relative Uri.");
if (control.CoreWebView2 != null && (oldValue == (Uri) null || oldValue.AbsoluteUri != newValue.AbsoluteUri))
control.CoreWebView2.Navigate(newValue.AbsoluteUri);
control.WhenInit_Source((Action) (() => control.EnsureCoreWebView2Async()));
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the WPF WebView2 implementation containing SourcePropertyChanged and inspect how null Source values are handled. Determine the intended exception type from nearby behavior or tests, update the null-value path, and verify the relevant WebView2 behavior if a test or reproduction entry point exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100