Discard lastIndexMarshalled variable if it is not otherwise used (#88060)
authorJackson Schuster <36744439+jtschuster@users.noreply.github.com>
Thu, 29 Jun 2023 16:30:01 +0000 (09:30 -0700)
committerGitHub <noreply@github.com>
Thu, 29 Jun 2023 16:30:01 +0000 (09:30 -0700)
commit3a21f96084967fac555cf2ac53c7e2d048e92fd1
treeb777cf573fc20d95f6e442fb926c01b532f3b524
parent672ff9b9c666c5d0eb27cf2e6f3f8447e21004d0
Discard lastIndexMarshalled variable if it is not otherwise used (#88060)

Tracks the last index marshalled in the interop generators to ensure we don't cleanup any unmarshalled elements. It discards the "last index marshalled" variable if it is unused in the cleanup stage.
15 files changed:
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ManagedToNativeVTableMethodGenerator.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/AttributedMarshallingModelGeneratorFactory.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/ElementsMarshalling.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/MarshallerHelpers.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/StatefulMarshallingStrategy.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/StatelessMarshallingStrategy.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/VariableDeclarations.cs
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/ComInterfaceGenerator.Tests.csproj
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/ArrayTests.cs
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CollectionMarshallingFails.cs [new file with mode: 0644]
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/LibraryImportGenerator.Tests.csproj
src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/Arrays.cs
src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj
src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/MarshallingFails/IStringArrayMarshallingFails.cs [new file with mode: 0644]