NoParamlessCtor 1.1.1-alpha.35.e8ab78e

This is a prerelease version of NoParamlessCtor.
dotnet add package NoParamlessCtor --version 1.1.1-alpha.35.e8ab78e
                    
NuGet\Install-Package NoParamlessCtor -Version 1.1.1-alpha.35.e8ab78e
                    
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="NoParamlessCtor" Version="1.1.1-alpha.35.e8ab78e" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NoParamlessCtor" Version="1.1.1-alpha.35.e8ab78e" />
                    
Directory.Packages.props
<PackageReference Include="NoParamlessCtor" />
                    
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 NoParamlessCtor --version 1.1.1-alpha.35.e8ab78e
                    
#r "nuget: NoParamlessCtor, 1.1.1-alpha.35.e8ab78e"
                    
#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 NoParamlessCtor@1.1.1-alpha.35.e8ab78e
                    
#: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=NoParamlessCtor&version=1.1.1-alpha.35.e8ab78e&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NoParamlessCtor&version=1.1.1-alpha.35.e8ab78e&prerelease
                    
Install as a Cake Tool

NoParamlessCtor

Source generator for blocking use of parameterless constructors! E.x. new SomeStruct() will result in a compile error.

<img width="997" alt="image" src="https://github.com/user-attachments/assets/6f21b59b-e4a5-47d2-b9a1-085a564121b4" />

Installation

https://www.nuget.org/packages/NoParamlessCtor

How to use

Declare a partial struct with the [NoParamlessCtor] attribute

Example:

[NoParamlessCtor]
public ref partial struct RefCtor(ref PrimaryCtor value)
{
    public ref PrimaryCtor Value = ref value;
}

Usecases

  • Structs that will have an invalid state if new()-ed. Note that it is still possible for the end-user to declare default(SomeStruct).
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on NoParamlessCtor:

Package Downloads
Tokenizers.NET

High-performance .NET wrapper of the Rust Tokenizers library

NativeMemoryTMD

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1-alpha.35.e8ab78e 69 3/13/2026
1.1.1-alpha.34.e8a1664 106 6/20/2025
1.1.1-alpha.33.561eab3 155 6/17/2025
1.1.1-alpha.31.cb558c4 213 6/15/2025
1.1.1-alpha.29.07c3a8d 159 6/15/2025
1.1.1-alpha.28.a8682da 156 6/15/2025
1.1.1-alpha.27.a1f638b 290 6/14/2025
1.1.1-alpha.26.9555736 173 6/14/2025
1.1.1-alpha.25.c63dcc5 179 6/14/2025
1.1.1-alpha.19.d231b15 183 6/14/2025
1.1.1-alpha.18.06dd30f 178 6/14/2025
1.1.1-alpha.17.cd35b52 190 6/14/2025
1.1.1-alpha.16.371a5c9 183 6/13/2025
1.1.1-alpha.15.1bf4dab 190 6/13/2025
1.1.1-alpha.14.ce280d1 187 6/13/2025
1.1.0-alpha.9-c247302 252 6/9/2025
1.1.0-alpha.13-e4282ec 189 6/13/2025
1.1.0-alpha.12-aeb53c0 275 6/9/2025
1.1.0-alpha.11-22cc2bc 238 6/9/2025
1.1.0-alpha.10-fe99a2c 222 6/9/2025
Loading failed