umbraco-nullable-reference-types
Write and fix Umbraco 17+ C# and Razor code under C# nullable reference types (NRT), which Umbraco has enabled since v10. Covers which Umbraco APIs return null (Value<T>() returning T?, Parent, GetById, Models Builder properties, media and picker values), the TryGetUmbracoContext / TryGetUmbracoHelper accessor pattern with [NotNullWhen] flow analysis, Razor null handling, and turning on <Nullable>enable</Nullable> with WarningsAsErrors=nullable without scattering the null-forgiving operator. Use this when the user mentions "nullable reference types", "NRT", CS8602 / CS8600 / CS8603 / CS8618 warnings in an Umbraco project, "possible null reference", "dereference of a possibly null reference", "null-forgiving operator", or asks to make Umbraco code null-safe. SKIP: non-Umbraco projects, Umbraco versions before 10, and general C# NRT questions with no Umbraco API involved.
来源信息
- 仓库
- umbraco/Umbraco-CMS-Implementation-Skills
- 最近来源活动
- 2026年10月21日 08:57
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 7
- Forks
- 8
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
| name | umbraco-nullable-reference-types |
|---|---|
| description | Write and fix Umbraco 17+ C# and Razor code under C# nullable reference types (NRT), which Umbraco has enabled since v10. Covers which Umbraco APIs return null (Value<T>() returning T?, Parent, GetById, Models Builder properties, media and picker values), the TryGetUmbracoContext / TryGetUmbracoHelper accessor pattern with [NotNullWhen] flow analysis, Razor null handling, and turning on <Nullable>enable</Nullable> with WarningsAsErrors=nullable without scattering the null-forgiving operator. Use this when the user mentions "nullable reference types", "NRT", CS8602 / CS8600 / CS8603 / CS8618 warnings in an Umbraco project, "possible null reference", "dereference of a possibly null reference", "null-forgiving operator", or asks to make Umbraco code null-safe. SKIP: non-Umbraco projects, Umbraco versions before 10, and general C# NRT questions with no Umbraco API involved. |