Skip to content

SourceGenerator Options

Boring3 edited this page Aug 15, 2024 · 6 revisions

MaxParameterCount

<FastNew_MaxParameterCount>16</FastNew_MaxParameterCount>

Type: Int32
Default: 16

Indicates the maximum number of parameters supported by FastNew.CreateInstance

PublicFastNewCore

<FastNew_PublicFastNewCore>false</FastNew_PublicFastNewCore>

Type: Boolean
Default: false

Indicates whether internal classes FastNew<...> should be marked as public or internal

PublicFastNew

<FastNew_PublicFastNew>false</FastNew_PublicFastNew>

Type: Boolean
Default: false

Indicates whether FastNew class should be marked as public or internal

GenerateCreateInstance

<FastNew_GenerateCreateInstance>true</FastNew_GenerateCreateInstance>

Type: Boolean
Default: true

Indicates whether FastNew.CreateInstance should be generated

GenerateTryCreateInstance

<FastNew_GenerateTryCreateInstance>true</FastNew_GenerateTryCreateInstance>

Type: Boolean
Default: true

Indicates whether FastNew.TryCreateInstance should be generated

GenerateTypeCreateInstance

<FastNew_GenerateTypeCreateInstance>true</FastNew_GenerateTypeCreateInstance>

Type: Boolean
Default: true

Indicates whether FastNew.GetCreateInstance should be generated

NonPublicConstructorSupport

<FastNew_NonPublicConstructorSupport>true</FastNew_NonPublicConstructorSupport>

Type: Boolean
Default: true

Indicates whether CreateInstance can use the non-public constructors.
This also affects trimmable related attributes.

Namespace

<FastNew_Namespace>FastGenericNew</FastNew_Namespace>

Type: String
Default: FastGenericNew

Specifies the namespace of the generated code.
Could be set to %EMPTY% to use global namespace (No namespace)

ForceFastNewDelegate

<FastNew_ForceFastNewDelegate>false</FastNew_ForceFastNewDelegate>

Type: Boolean
Default: false

Indicates whether FastGenericNew should create&use its own delegate even the corresponding Func<> is available.

AlertGeneratedFile

<FastNew_AlertGeneratedFile>true</FastNew_AlertGeneratedFile>

Type: Boolean
Default: true

Indicates whether FastGenericNew should write an alert in the header of generated files that the file is generated by SourceGenerator.

DisableGeneratorCache

<FastNew_DisableGeneratorCache>false</FastNew_DisableGeneratorCache>

Type: Boolean
Default: false

Indicates whether FastGenericNew should disable the aggressive caching strategy.
This option doesn't affect the basic caching strategy of Incremental Generator.

PrettyOutput

<FastNew_PrettyOutput>false</FastNew_PrettyOutput>

Type: Boolean
Default: false

Indicates whether FastGenericNew should try to generate pretty code.

MultiThreadedGeneration

<FastNew_MultiThreadedGeneration>true</FastNew_MultiThreadedGeneration>

Type: Boolean
Default: true

Indicates whether FastGenericNew should run in parallel.
This can significantly improve build performance on a multi-core processor.

OutputGenerationInfo

<FastNew_OutputGenerationInfo>false</FastNew_OutputGenerationInfo>

Type: Boolean
Default: false

Indicates whether FastGenericNew should generate a file that contains current SourceGenerator options.
This option is used to debug the library.

AllowUnsafeImplementation

<FastNew_AllowUnsafeImplementation>false</FastNew_AllowUnsafeImplementation>

Type: Boolean
Default: false

Indicates whether FastGenericNew is allowed to use unsafe implementation.
Enables FastNew.CreateInstance<T> to call CLR API RuntimeTypeHandle_GetActivationInfo if available at runtime.
This can significantly improve first-call initialization speed (Almost the same as Activator)
But may also slightly decrease the performance of FastNew.CreateInstance<T> (about 1ns per call, still much faster than Activator )