Examples of errors detected by the V3070 diagnostic
V3070. Uninitialized variables are used when initializing the 'A' variable.
Mono
V3070 Uninitialized variable 'schema' is used when initializing the 'ResourceSchema' variable. ResXResourceWriter.cs 59
class ResXResourceWriter : IResourceWriter, IDisposable
{
....
public static readonly string ResourceSchema = schema; // <=
....
static string schema = ....; // <=
....
}
PascalABC.NET
V3070 Uninitialized variable 'event_add_method_prefix' is used when initializing the 'event_add_method_nameformat' variable. TreeConverter compiler_string_consts.cs 313
public static class compiler_string_consts
{
....
public static string event_add_method_nameformat =
event_add_method_prefix + "{0}";
....
public static string event_add_method_prefix = "add_";
....
}
Similar errors can be found in some other places:
- V3070 Uninitialized variable 'event_remove_method_prefix' is used when initializing the 'event_remove_method_nameformat' variable. TreeConverter compiler_string_consts.cs 314
RunUO
V3070 Uninitialized variable 'Zero' is used when initializing the 'm_LastMobile' variable. Serial.cs 29
public struct Serial : IComparable, IComparable<Serial>
{
private int m_Serial;
private static Serial m_LastMobile = Zero; // <=
private static Serial m_LastItem = 0x40000000;
public static Serial LastMobile { .... }
public static Serial LastItem { .... }
public static readonly Serial MinusOne = new Serial( -1 );
public static readonly Serial Zero = new Serial( 0 ); // <=
....
private Serial( int serial )
{
m_Serial = serial;
}
....
}
ILSpy
V3070 Uninitialized variable 'schema' is used when initializing the 'ResourceSchema' variable. ICSharpCode.Decompiler ResXResourceWriter.cs 63
class ResXResourceWriter : IDisposable
{
....
public static readonly string ResourceSchema = schema; // <=
....
static string schema = ....; // <=
....
}
The same error was found in project Mono.
AvalonStudio
V3070 Uninitialized variable 'SolarizedLight' is used when initializing the 'DefaultColorScheme' variable. ColorScheme.cs 32
public class ColorScheme
{
private static readonly ColorScheme DefaultColorScheme =
ColorScheme.SolarizedLight;
....
public static readonly ColorScheme SolarizedLight = new ColorScheme
{
....
};
}
AWS SDK for .NET
V3070 Uninitialized variable 'LATEST' is used when initializing the 'EC2_METADATA_ROOT' variable. EC2InstanceMetadata.cs 57
public static class EC2InstanceMetadata
{
[Obsolete("EC2_METADATA_SVC is obsolete, refer to ServiceEndpoint
instead to respect environment and profile overrides.")]
public static readonly string EC2_METADATA_SVC = "http://169.254.169.254";
[Obsolete("EC2_METADATA_ROOT is obsolete, refer to EC2MetadataRoot
instead to respect environment and profile overrides.")]
public static readonly string
EC2_METADATA_ROOT = EC2_METADATA_SVC + LATEST + "/meta-data"; // <=
[Obsolete("EC2_USERDATA_ROOT is obsolete, refer to EC2UserDataRoot
instead to respect environment and profile overrides.")]
public static readonly string
EC2_USERDATA_ROOT = EC2_METADATA_SVC + LATEST + "/user-data"; // <=
[Obsolete("EC2_DYNAMICDATA_ROOT is obsolete, refer to EC2DynamicDataRoot
instead to respect environment and profile overrides.")]
public static readonly string
EC2_DYNAMICDATA_ROOT = EC2_METADATA_SVC + LATEST + "/dynamic"; // <=
[Obsolete("EC2_APITOKEN_URL is obsolete, refer to EC2ApiTokenUrl
instead to respect environment and profile overrides.")]
public static readonly string
EC2_APITOKEN_URL = EC2_METADATA_SVC + LATEST + "/api/token"; // <=
public static readonly string
LATEST = "/latest",
AWS_EC2_METADATA_DISABLED = "AWS_EC2_METADATA_DISABLED";
....
}
Similar errors can be found in some other places:
- V3070 Uninitialized variable 'LATEST' is used when initializing the 'EC2_USERDATA_ROOT' variable. EC2InstanceMetadata.cs 60
- V3070 Uninitialized variable 'LATEST' is used when initializing the 'EC2_DYNAMICDATA_ROOT' variable. EC2InstanceMetadata.cs 63
- V3070 Uninitialized variable 'LATEST' is used when initializing the 'EC2_APITOKEN_URL' variable. EC2InstanceMetadata.cs 66