NullWizard 1.0.0

dotnet add package NullWizard --version 1.0.0
                    
NuGet\Install-Package NullWizard -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NullWizard" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NullWizard" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NullWizard" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NullWizard --version 1.0.0
                    
#r "nuget: NullWizard, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NullWizard@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NullWizard&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NullWizard&version=1.0.0
                    
Install as a Cake Tool

NullWizard 🧙‍♂️

A powerful Roslyn-based null intelligence layer that learns null-handling patterns from codebases and provides context-aware auto-fixes.

🎯 Features

  • 🔍 Codebase Analysis: Automatically discovers null handling patterns in your codebase
  • 🤖 Auto-Fix: Provides intelligent suggestions and automatic fixes for null-related issues
  • 📦 Package Detection: Detects popular packages and applies tailored null handling rules
  • 🔄 Version-Specific Rules: Adapts to different .NET target frameworks
  • 🎨 Roslyn Integration: Seamless integration with Visual Studio and other IDEs
  • 📊 Pattern Learning: Learns from your existing code patterns to provide better suggestions

🚀 Quick Start

Installation

# Add NullWizard to your project
dotnet add package NullWizard

Basic Usage

NullWizard will automatically analyze your codebase and provide suggestions for null handling improvements.

🎯 Package-Specific Patterns

NullWizard includes specialized patterns for popular packages:

UI Frameworks

  • Avalonia: UI controls, data binding, and MVVM patterns
  • WPF: XAML controls and data binding scenarios
  • WinForms: Legacy Windows Forms patterns
  • Xamarin: Mobile development patterns

Data & Serialization

  • Newtonsoft.Json: JSON deserialization and serialization
  • System.Text.Json: Modern JSON handling
  • Entity Framework: Database query results and navigation properties
  • NHibernate: ORM patterns and lazy loading

Web & API

  • HttpClient: HTTP responses and content
  • RestSharp: REST API responses
  • System.Web: ASP.NET patterns
  • Web API: Controller actions and model binding

Logging & DI

  • NLog: Logging patterns and configuration
  • Log4Net: Legacy logging scenarios
  • Autofac: Dependency injection containers
  • Castle Windsor: IoC container patterns

Mobile & Legacy

  • Mono.Android: Android development patterns
  • MonoTouch: iOS development patterns
  • System.Web.Mvc: MVC patterns
  • System.Web.Http: Web API patterns

📋 Supported Frameworks

  • .NET Standard 2.0+
  • .NET Framework 4.5+
  • .NET Core 1.0+
  • .NET 5.0+
  • .NET 6.0+
  • .NET 7.0+
  • .NET 8.0+

🏗️ Architecture

NullWizard/
├── NullWizard.Core/          # Core models and interfaces
├── NullWizard.Analyzer/      # Roslyn analyzer implementation
└── NullWizard.Rules/         # Version-specific and package rules

Core Components

  • ICodebaseAnalyzer: Analyzes codebases for null patterns
  • NullPattern: Represents discovered null handling patterns
  • NullContext: Defines different contexts where null can occur
  • NullStrategy: Available strategies for handling null values

🔧 Configuration

Custom Rules

You can define custom null handling patterns:

var customPattern = new NullPattern
{
    PatternId = "MyCustomPattern",
    Description = "Custom null handling for my domain",
    Context = NullContext.DomainModel,
    Strategy = NullStrategy.ValidateAndTransform,
    CodePattern = "MyClass.Property",
    FixPattern = "MyClass.Property ?? DefaultValue"
};

Framework-Specific Rules

NullWizard automatically detects your target framework and applies appropriate rules:

// For .NET Standard 2.0
var rules = VersionSpecificRules.GetNetStandard20Rules();

// For .NET Framework 4.5
var rules = VersionSpecificRules.GetNetFramework45Rules();

🎨 Integration

Visual Studio

NullWizard integrates seamlessly with Visual Studio, providing:

  • Real-time analysis
  • Quick fixes and refactorings
  • IntelliSense suggestions
  • Error highlighting

Command Line

# Analyze a codebase
dotnet build --verbosity normal

# NullWizard will show suggestions during build

📊 Example Patterns

Avalonia UI Patterns

// Before: Potential null reference
var text = textBox.Text; // CS8602 warning

// After: Null-aware handling
var text = textBox?.Text ?? string.Empty;

Newtonsoft.Json Patterns

// Before: Potential null after deserialization
var data = JsonConvert.DeserializeObject<MyData>(json);
var name = data.Name; // CS8602 warning

// After: Null-safe deserialization
var data = JsonConvert.DeserializeObject<MyData>(json) ?? new MyData();
var name = data.Name ?? "Unknown";

HttpClient Patterns

// Before: Potential null response
var response = await httpClient.GetAsync(url);
var content = response.Content; // CS8602 warning

// After: Null-safe HTTP handling
var response = await httpClient.GetAsync(url);
var content = response?.Content ?? new StringContent(string.Empty);

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add your patterns and rules
  4. Submit a pull request

Adding New Patterns

public static List<NullPattern> GetMyPackageRules()
{
    return new List<NullPattern>
    {
        new NullPattern
        {
            PatternId = "MyPackage.Property",
            Description = "Handle null properties in MyPackage",
            Context = NullContext.PropertyGetter,
            Strategy = NullStrategy.NullCoalescing,
            CodePattern = "MyPackage.Property",
            FixPattern = "MyPackage.Property ?? DefaultValue"
        }
    };
}

📄 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments

  • Built with Roslyn for powerful code analysis
  • Inspired by the need for better null handling in legacy .NET codebases
  • Community-driven pattern discovery and improvement

NullWizard: Making null handling intelligent, one codebase at a time! 🧙‍♂️✨

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 250 9/4/2025