dotnet / dotnet/wpf

System.Windows.Media.Pen.DashCap uses PenLineCap instead of PenDashCap

Open
#6,273 2 comments 0 reactions 1 assignee Claimed by @dipeshmsft View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .NET Core Version: 6.0
* Windows version: 10 build 19043.1586
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? **No**

**Problem description:**

`System.Windows.Media.Pen.DashCap` is of type `enum` `System.Windows.Media.PenLineCap` . The namespace has `enum` `System.Windows.Media.PenDashCap` which by the name seems to be the correct enum for this property.

The reference source for .Net 4.8 has the following (internal) comment reinforcing the mismatched type.

```
///
/// Pen - Initializes the brush from the parameters.
///
/// The Pen's Brush.
/// The Pen's thickness.
/// The PenLineCap which applies to the start of the stroke.
/// The PenLineCap which applies to the end of the stroke.
/// The PenDashCap which applies to the ends of each dash. //<--------- Incorrect
/// The PenLineJoin.
/// The miter limit.
/// The dash style.
```

**Actual behavior:**

Use the `PenLineCap` enum in the property `Pen.DashCap`

**Expected behavior:**

Expected to use `System.Windows.Media.PenDashCap` in the property `Pen.DashCap`

**Minimal repro:**

See the docs:

https://referencesource.microsoft.com/#PresentationCore/Core/CSharp/System/Windows/Media/Pen.cs,abab5dce39ebd2ad

https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.pendashcap?view=windowsdesktop-6.0

https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.pen?view=windowsdesktop-6.0

Maybe `PenDashCap` should be removed from the namespace, I can't find any used instances of the enum.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.