Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Roslyn.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,8 @@ Global
src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5
src\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems*{fa0e905d-ec46-466d-b7b2-3b5557f9428c}*SharedItemsImports = 5
src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{fa0e905d-ec46-466d-b7b2-3b5557f9428c}*SharedItemsImports = 5
src\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems*{fc2ae90b-2e4b-4045-9fdd-73d4f5ed6c89}*SharedItemsImports = 5
src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{fc2ae90b-2e4b-4045-9fdd-73d4f5ed6c89}*SharedItemsImports = 5
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis.Utilities.projitems*{fcb56cba-fa35-46a8-86b7-bae5433197d9}*SharedItemsImports = 13
src\RoslynAnalyzers\Utilities\Compiler\Analyzer.Utilities.projitems*{fce0046b-03f8-78f6-86a1-8ddcee8f4c9f}*SharedItemsImports = 5
src\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems*{fce88bbd-9bbd-4871-b9b0-de176d73a6b0}*SharedItemsImports = 5
Expand Down
6 changes: 6 additions & 0 deletions src/Dependencies/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[*.cs]

# IDE0240: Remove redundant nullable directive
# The directive needs to be included since all sources in a source package are considered generated code
# when referenced from a project via package reference.
dotnet_diagnostic.IDE0240.severity = none
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

namespace Microsoft.CodeAnalysis.Debugging
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable
#nullable enable

using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -40,7 +40,7 @@ public CustomDebugInfoEncoder(BlobBuilder builder)
public readonly int RecordCount => _recordCount;

/// <exception cref="InvalidOperationException">More than <see cref="byte.MaxValue"/> records added.</exception>
public readonly byte[] ToArray()
public readonly byte[]? ToArray()
{
if (_recordCount == 0)
{
Expand All @@ -54,8 +54,6 @@ public readonly byte[] ToArray()

public void AddStateMachineTypeName(string typeName)
{
Debug.Assert(typeName != null);

AddRecord(
CustomDebugInfoKind.StateMachineTypeName,
typeName,
Expand Down Expand Up @@ -142,8 +140,6 @@ public void AddStateMachineHoistedLocalScopes(ImmutableArray<StateMachineHoisted

public void AddDynamicLocals(IReadOnlyCollection<(string LocalName, byte[] Flags, int Count, int SlotIndex)> dynamicLocals)
{
Debug.Assert(dynamicLocals != null);

AddRecord(
CustomDebugInfoKind.DynamicLocals,
dynamicLocals,
Expand All @@ -168,8 +164,6 @@ public void AddDynamicLocals(IReadOnlyCollection<(string LocalName, byte[] Flags

public void AddTupleElementNames(IReadOnlyCollection<(string LocalName, int SlotIndex, int ScopeStart, int ScopeEnd, ImmutableArray<string> Names)> tupleLocals)
{
Debug.Assert(tupleLocals != null);

AddRecord(
CustomDebugInfoKind.TupleElementNames,
tupleLocals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable
#nullable enable

namespace Microsoft.CodeAnalysis.Debugging
{
Expand Down
13 changes: 7 additions & 6 deletions src/Dependencies/CodeAnalysis.Debugging/CustomDebugInfoReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable
#nullable enable

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using Microsoft.CodeAnalysis.PooledObjects;
Expand Down Expand Up @@ -313,7 +314,7 @@ public static ImmutableArray<TupleElementNamesInfo> DecodeTupleElementNamesRecor
private static TupleElementNamesInfo DecodeTupleElementNamesInfo(ImmutableArray<byte> bytes, ref int offset)
{
var n = ReadInt32(bytes, ref offset);
var builder = ArrayBuilder<string>.GetInstance(n);
var builder = ArrayBuilder<string?>.GetInstance(n);
for (var i = 0; i < n; i++)
{
var value = ReadUtf8String(bytes, ref offset);
Expand All @@ -337,7 +338,7 @@ private static TupleElementNamesInfo DecodeTupleElementNamesInfo(ImmutableArray<
public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrings<TArg>(
int methodToken,
TArg arg,
Func<int, TArg, byte[]> getMethodCustomDebugInfo,
Func<int, TArg, byte[]?> getMethodCustomDebugInfo,
Func<int, TArg, ImmutableArray<string>> getMethodImportStrings,
out ImmutableArray<string> externAliasStrings)
{
Expand Down Expand Up @@ -572,7 +573,7 @@ private static bool IsCSharpExternAliasInfo(string import)
/// "TSystem.Math" -> <type name="System.Math" />
/// ]]>
/// </remarks>
public static bool TryParseCSharpImportString(string import, out string alias, out string externAlias, out string target, out ImportTargetKind kind)
public static bool TryParseCSharpImportString(string import, out string? alias, out string? externAlias, out string? target, out ImportTargetKind kind)
{
alias = null;
externAlias = null;
Expand Down Expand Up @@ -673,7 +674,7 @@ public static bool TryParseCSharpImportString(string import, out string alias, o
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="import"/> is null.</exception>
/// <exception cref="ArgumentException">Format of <paramref name="import"/> is not valid.</exception>
public static bool TryParseVisualBasicImportString(string import, out string alias, out string target, out ImportTargetKind kind, out VBImportScopeKind scope)
public static bool TryParseVisualBasicImportString(string import, out string? alias, out string? target, out ImportTargetKind kind, out VBImportScopeKind scope)
{
alias = null;
target = null;
Expand Down Expand Up @@ -820,7 +821,7 @@ public static bool TryParseVisualBasicImportString(string import, out string ali
}
}

private static bool TrySplit(string input, int offset, char separator, out string before, out string after)
private static bool TrySplit(string input, int offset, char separator, [NotNullWhen(true)] out string? before, [NotNullWhen(true)] out string? after)
{
var separatorPos = input.IndexOf(separator, offset);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable
#nullable enable

using System.Collections.Immutable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable
#nullable enable

using System.Collections.Immutable;

Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/CodeAnalysis.Debugging/ImportTargetKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

namespace Microsoft.CodeAnalysis.Debugging
{
internal enum ImportTargetKind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="System.ValueTuple" />
<ProjectReference Include="..\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.Package.csproj" />
</ItemGroup>
<Import Project="..\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems" Label="Shared" />
<Import Project="..\Contracts\Microsoft.CodeAnalysis.Contracts.projitems" Label="Shared" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;

namespace Microsoft.CodeAnalysis.Debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable
#nullable enable

using System.Diagnostics;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable
#nullable enable

using System.Collections.Immutable;
using System.Diagnostics;
Expand All @@ -11,13 +11,13 @@ namespace Microsoft.CodeAnalysis.Debugging
{
internal readonly struct TupleElementNamesInfo
{
internal readonly ImmutableArray<string> ElementNames;
internal readonly ImmutableArray<string?> ElementNames;
internal readonly int SlotIndex; // Locals only
internal readonly string LocalName;
internal readonly int ScopeStart; // Constants only
internal readonly int ScopeEnd; // Constants only

internal TupleElementNamesInfo(ImmutableArray<string> elementNames, int slotIndex, string localName, int scopeStart, int scopeEnd)
internal TupleElementNamesInfo(ImmutableArray<string?> elementNames, int slotIndex, string localName, int scopeStart, int scopeEnd)
{
Debug.Assert(!elementNames.IsDefault);

Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/CodeAnalysis.Debugging/VBImportScopeKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

namespace Microsoft.CodeAnalysis.Debugging
{
internal enum VBImportScopeKind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Collections;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/ArraySortHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://github.com/dotnet/runtime/blob/v8.0.3/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs
//
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/BitHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://github.com/dotnet/runtime/blob/v8.0.3/src/libraries/Common/src/System/Collections/Generic/BitHelper.cs
//
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/HashHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://github.com/dotnet/runtime/blob/v8.0.3/src/libraries/System.Private.CoreLib/src/System/Collections/HashHelpers.cs
//
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/ICollectionCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Collections;

Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/ICollectionCalls`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Collections.Generic;

namespace Microsoft.CodeAnalysis.Collections.Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://github.com/dotnet/runtime/blob/v8.0.3/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ICollectionDebugView.cs
//
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/IDictionaryCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Collections;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://github.com/dotnet/runtime/blob/v8.0.3/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/IDictionaryDebugView.cs
//
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/IEnumerableCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Collections;

namespace Microsoft.CodeAnalysis.Collections.Internal
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/IEnumerableCalls`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Collections.Generic;

namespace Microsoft.CodeAnalysis.Collections.Internal
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/IListCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Collections;

namespace Microsoft.CodeAnalysis.Collections.Internal
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/InsertionBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://github.com/dotnet/runtime/blob/v8.0.3/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/InsertionBehavior.cs
//
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/RoslynUnsafe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Runtime.CompilerServices;

namespace Microsoft.CodeAnalysis.Collections.Internal
Expand Down
2 changes: 2 additions & 0 deletions src/Dependencies/Collections/Internal/SegmentedArrayHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

namespace Microsoft.CodeAnalysis.Collections.Internal
{
internal readonly struct SegmentedArraySegment<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://github.com/dotnet/runtime/blob/v8.0.3/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/HashSetEqualityComparer.cs
//
Expand Down
Loading