-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
The codebase currently has <Nullable>disable</Nullable> in the project file and suppresses CS8632 warnings. We should enable nullable reference types and properly annotate the codebase for improved null safety.
Current State
Docxodus.csprojhas<Nullable>disable</Nullable>- CS8632 warnings are suppressed via
<NoWarn>$(NoWarn);CS8073;CA2200;CS8632</NoWarn> - Some files already have nullable annotations (
?) but without the nullable context enabled
Scope
Enabling nullable produces ~9,000 warnings across 61 source files. The most common issues:
| Warning | Description | Count |
|---|---|---|
| CS8600 | Converting possible null to non-nullable type | ~3,100 |
| CS8602 | Dereference of possibly null reference | ~2,300 |
| CS8604 | Possible null reference argument | ~1,500 |
| CS8618 | Non-nullable field uninitialized in constructor | ~600 |
| CS8625 | Cannot convert null literal to non-nullable type | ~570 |
| CS8603 | Possible null reference return | ~530 |
Recommended Approach
An incremental file-by-file approach is best:
- Add
#nullable enableat the top of individual files - Fix warnings in that file (add
?annotations, null checks, or!where safe) - Run tests to verify behavior unchanged
- Repeat for next file
Start with smaller, simpler files to build momentum.
Work Required
- Incrementally enable nullable per-file with
#nullable enable - Add appropriate nullable annotations to public APIs
- Fix or suppress nullable warnings in legacy code
- Once all files are done, enable
<Nullable>enable</Nullable>in csproj - Remove CS8632 from NoWarn
Files to Prioritize
Smaller utility files first, then tackle the larger ones:
PtOpenXmlUtil.cs- many nullable issues (large file)WmlToHtmlConverter.cs- ImageInfo class fieldsWmlComparer.cs- comparison unit classes
Labels
enhancementtech-debt
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request