Resizer: variable font files: unable to load valid file names
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- android, csharp
- 领域
- build-system, mobile
调研方向
该失败指向第 568 行的 Microsoft.Maui.Resizetizer.After.targets,而复现使用了 ConfigureFonts 中的 OpenSans-VariableFont_wdth,wght.ttf。首先使用该可变字体复现 MSBuild 错误,然后检查 target 如何处理文件名,并通过一次干净的重新构建验证结果。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
When you download font from https://fonts.google.com/specimen/Open+Sans
you have the choice to use a "variable" font file.
"variable" font files contains alternative axes. Foe ex:
wdth
wght
This is more practical than to use many static font files to get BOLD, MEDIUM etc ...
Both android 12+ and iOS 11+ support variable font files.
Example of a valid file name:
OpenSans-Italic-VariableFont_wdth,wght.ttf
When you add that file to the Fonts folder, resizer crashes.
1>Microsoft.Maui.Resizetizer.After.targets(568,17): Error MSB4186 : Invalid static method invocation syntax: "[System.IO.Path]::GetFileName(obj\Debug\net10.0-android\android-x64\resizetizer\f\OpenSans-VariableFont_wdth,wght.ttf)". Method 'System.IO.Path.GetFileName' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order.
When you rename the file, resizer continues to crash. Until your clean and rebuild.
Regression
No response
Steps to reproduce
You can download the font "OpenSans" on google font.
Both android 12+ and iOS 11+ support variable font files.
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-VariableFont_wdth,wght.ttf", "OpenSans");
});
``
### Expected behavior
don't crash :)
### Screenshots
_No response_
### IDE and version
Rider
### IDE version
2025.3.0.1
### Nuget packages
- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [ ] CommunityToolkit.Mvvm (aka MVVM Toolkit)
### Nuget package version(s)
10.0.10
### Additional context
- OS: Window 11
- Target: maui android 10
- VS 2026
### Help us help you
No, just wanted to report this
- 主要语言
- C#
- 星标
- 3.8k
- 派生
- 402
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CommunityToolkit/dotnet 的其他 Issue
-
RelayCommand<T>.CanExecute(null) returns false for value types without a predicate可能已有人在做 @apachezy 于 94 天前认领。 未关闭bug :bug:
难度 2/5 1-3 小时 新手友好度 84/100
CommunityToolkit/dotnet#1206 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
难度 1/5 1 小时以内 新手友好度 68/100
CommunityToolkit/dotnet#648 ·
-
难度 5/5 一周以上 新手友好度 35/100
CommunityToolkit/dotnet#1217 ·
-
bug :bug:
难度 3/5 1-2 天 新手友好度 68/100
CommunityToolkit/dotnet#1215 · 2 条评论 ·
查看 CommunityToolkit/dotnet 的全部 Issue
相似的 Issue
-
bug P2
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/SimpleL7Proxy#302 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
QuantConnect/Lean#9957 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复