Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

EgorBo/UnsafeCodeAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

37 Commits

Repository files navigation

UnsafeCodeAnalyzer

A tool to analyze the usage of memory-unsafe code in a C# codebase.

Usage example:

# Using the DotnetRuntimeRepo preset for dotnet/runtime repository
dotnet run -- analyze --dir D:\runtime --report D:\runtime.csv --preset DotnetRuntimeRepo
# Using the generic preset for any repository
dotnet run -- analyze --dir D:\aspnetcore --report D:\aspnetcore.csv --preset Generic

Output example

Console output:

 Total methods: 134802
 Total P/Invokes: 2650
 Total methods with 'unsafe' context: 7097
 Total methods with Unsafe API calls: 2480

Markdown report:

Assembly Total
methods
P/Invokes Methods with
'unsafe' context
Methods with
Unsafe API calls
System.Private.CoreLib 21648 325 1714 1361
Common 5966 2143 973 172
Other 3020 0 1153 0
nativeaot 4350 40 833 111
cDAC 1083 0 423 1
System.Security.Cryptography 4818 0 219 73
System.Net.Http 2260 90 85 17
mono 5711 12 155 18
Other 85946 40 1542 727
Total 134802 2650 7097 2480

There is also a CSV export available.

Installation and requirements

All platforms .NET supports.
TODO: publish as a dotnet-tool

About

Code memory safety analysis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /