dotnet / dotnet/roslyn

Nullable flow analysis for unmanaged pointers

Open
#80,305 1 comment 0 reactions 0 assignees View on GitHub
Area-Language Design
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

## Problem / Motivation

Roslyn does nullable flow analysis to warn when a reference type might be null. However, unmanaged pointers (e.g. `int*`, `void*`, etc.) currently do *not* participate in nullable flow analysis, so potential null dereferences can not be reported in the same way.

This gap can lead to safety issues in unsafe code, and makes it harder for developers to reason about pointer nullability. It also reduces consistency, reference type nullability is tracked, but pointer nullability is not.

## Proposal

- Extend Roslyn’s nullable flow analysis to include unmanaged pointers.

## Related Issues
* https://github.com/dotnet/runtime/pull/119745

Contributor guide

Open the contributing guide

Research direction

Start by reading Roslyn's existing nullable flow analysis and the related dotnet/runtime pull request linked in the issue. The work is done when unmanaged pointers such as int* and void* participate in nullable flow analysis and potential null dereferences receive corresponding warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.