microsoft / microsoft/win32metadata

Trim whitespace when parsing `<TraverseFiles>` contents?

Open
#1,838 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
1.5k
Forks
149
Avg merge
5d 16h
Merged PRs (30d)
4

Description

For https://github.com/Tsukisoft/direct-storage-rs/pull/5

We had a list of the form:

```xml

$(PkgMicrosoft_Direct3D_DirectStorage)\native\include\dstorage.h;
$(PkgMicrosoft_Direct3D_DirectStorage)\native\include\dstorageerr.h

```

But no constants from `dstorageerr.h` were parsed. Swapping the filenames makes it so that `#define`s from `dstorage.h` are lost, but defines from `dstorageerr.h` are parsed.

I believe the raw string it's parsing here is: `dstorage.h;\ndstorageerr.h\n`, splitting this on `;` causes the last filename to never match. Perhaps a `string item = items[i].Trim();` is missing here to make multiline filename strings work more naturally?

https://github.com/microsoft/win32metadata/blob/3d2ba1e501e46f078e4b4670a52ed68890870f8a/sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs#L476-L488

After all, when merging this into one line:

```xml
$(PkgMicrosoft_Direct3D_DirectStorage)\native\include\dstorage.h;$(PkgMicrosoft_Direct3D_DirectStorage)\native\include\dstorageerr.h
```

Both files were finally parsed correctly.

Contributor guide

Open the contributing guide

Research direction

Start with sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs lines 476-488 and reproduce the multiline input using the two DirectStorage headers shown in the issue. Verify that parsing the newline-separated entries recognizes both headers and that the corresponding defines are processed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.