Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate an 'out' local variable for unmanaged to managed stubs when the value needs to be marshalled out to unmanaged #89139

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dc6356f
Fully qualify return type on UnreachableException methods
jtschuster Jun 15, 2023
0cc937e
Merge branch 'main' of https://github.com/dotnet/runtime
jtschuster Jun 16, 2023
a16a7d6
Merge branch 'main' of https://github.com/dotnet/runtime
jtschuster Jun 19, 2023
cca57d3
Merge branch 'main' of https://github.com/dotnet/runtime
jtschuster Jun 28, 2023
ed7cd71
wip
jtschuster Jul 5, 2023
744a39b
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 5, 2023
788c862
wip
jtschuster Jul 13, 2023
d4aaad5
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 13, 2023
7363299
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 14, 2023
1e1345b
wip
jtschuster Jul 17, 2023
5c0ba6a
builds the interop sln. repo build failing
jtschuster Jul 18, 2023
203807e
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 18, 2023
f2d7921
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 18, 2023
2b99032
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 18, 2023
0a532ad
Revert "Update dependencies from https://github.com/dotnet/roslyn bui…
jtschuster Jul 18, 2023
8128579
Revert "Revert "Update dependencies from https://github.com/dotnet/ro…
jtschuster Jul 18, 2023
acf29cc
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 18, 2023
f8da5a1
Fix changes to other files
jtschuster Jul 18, 2023
8a8f573
fix changes within interop sln
jtschuster Jul 18, 2023
86099a2
Tests pass
jtschuster Jul 18, 2023
8b14784
Remove trailing space
jtschuster Jul 18, 2023
ee7de7f
Remove commented code
jtschuster Jul 18, 2023
cf38596
Refactor com interfaces and rename isMidlOut
jtschuster Jul 18, 2023
29a6bad
PR feedback: rename _guid, be consistent in local vs property use
jtschuster Jul 18, 2023
1627cc9
Remove temp test project
jtschuster Jul 18, 2023
c25b5d7
wip
jtschuster Jul 19, 2023
31d5f1b
wip
jtschuster Jul 19, 2023
5370aa4
Merge branch 'main' of https://github.com/dotnet/runtime into Marshal…
jtschuster Jul 19, 2023
c615eb2
Almost Passing tests, skipping [out] collections cleanup
jtschuster Jul 21, 2023
525f58c
Passing tests
jtschuster Jul 21, 2023
0fccde6
Remove extraneous changes
jtschuster Jul 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public BlockSyntax GenerateStubBody(ExpressionSyntax methodToInvoke)
setupStatements.Add(MarshallerHelpers.Declare(PredefinedType(Token(SyntaxKind.BoolKeyword)), InvokeSucceededIdentifier, initializeToDefault: true));
}

setupStatements.AddRange(declarations.Initializations);
setupStatements.AddRange(declarations.Variables);
setupStatements.AddRange(declarations.Initializations);
setupStatements.AddRange(statements.Setup);

List<StatementSyntax> tryStatements = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ private static ImmutableArray<StatementSyntax> GenerateStatementsForStubContext(
ImmutableArray<StatementSyntax>.Builder statementsToUpdate = ImmutableArray.CreateBuilder<StatementSyntax>();
foreach (BoundGenerator marshaller in marshallers.SignatureMarshallers)
{
statementsToUpdate.AddRange(marshaller.Generator.Generate(marshaller.TypeInfo, context));
var localContext = context;
jtschuster marked this conversation as resolved.
Show resolved Hide resolved
if (context.CurrentStage is StubCodeContext.Stage.Marshal
&& MarshallerHelpers.IsMidlOutBehavior(marshaller.TypeInfo, context))
{
localContext = new MarshalToLocalContext(context);
}
statementsToUpdate.AddRange(marshaller.Generator.Generate(marshaller.TypeInfo, localContext));
}

if (statementsToUpdate.Count > 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;

namespace Microsoft.Interop
{
internal sealed record MarshalToLocalContext : StubCodeContext
{
internal StubCodeContext InnerContext { get; init; }

internal MarshalToLocalContext(StubCodeContext inner)
{
InnerContext = inner;
CurrentStage = inner.CurrentStage;
Direction = inner.Direction;
ParentContext = inner.ParentContext;
}

public override (TargetFramework framework, Version version) GetTargetFramework() => InnerContext.GetTargetFramework();

public override bool SingleFrameSpansNativeContext => InnerContext.SingleFrameSpansNativeContext;

public override bool AdditionalTemporaryStateLivesAcrossStages => InnerContext.AdditionalTemporaryStateLivesAcrossStages;

public override (string managed, string native) GetIdentifiers(TypePositionInfo info)
=> InnerContext.GetIdentifiers(info);
//=> (inner.GetIdentifiers(info).managed, inner.GetAdditionalIdentifier(info, "out"));

public override string GetAdditionalIdentifier(TypePositionInfo info, string name) => InnerContext.GetAdditionalIdentifier(info, name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -394,5 +394,17 @@ public static MarshalDirection GetMarshalDirection(TypePositionInfo info, StubCo
}
throw new UnreachableException("An element is either a return value or passed by value or by ref.");
}

/// <summary>
/// Returns whether a parameter has MIDL '[out]' behavior should be unmarshalled into a local variable and only assigned to the parameter at the end of the function call.
/// </summary>
public static bool IsMidlOutBehavior(TypePositionInfo info, StubCodeContext context)
jtschuster marked this conversation as resolved.
Show resolved Hide resolved
=> context.Direction is MarshalDirection.UnmanagedToManaged
&& (info.IsByRef && info.RefKind is RefKind.Out or RefKind.Ref
|| info.ByValueContentsMarshalKind.HasFlag(ByValueContentsMarshalKind.Out)
|| info.IsManagedReturnPosition);

internal static StatementSyntax CreateDiscardStatement(string identifier)
=> ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, IdentifierName("_"), IdentifierName(identifier)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,51 @@ public static VariableDeclarations GenerateDeclarationsForUnmanagedToManaged(Bou
foreach (BoundGenerator marshaller in marshallers.NativeParameterMarshallers)
{
TypePositionInfo info = marshaller.TypeInfo;
if (info.IsNativeReturnPosition || info.IsManagedReturnPosition)
if (info.IsNativeReturnPosition)
continue;

if (info.IsManagedReturnPosition)
continue;

// Declare variables for parameters
AppendVariableDeclarations(variables, marshaller, context, initializeToDefault: initializeDeclarations);

{
// We need to use the 'out' value - This should be removed once the ownership behavior is fixed
var boundaryBehavior = marshaller.Generator.GetValueBoundaryBehavior(info, context);
if (marshaller.Generator.UsesNativeIdentifier(marshaller.TypeInfo, context)
&& boundaryBehavior is not
(ValueBoundaryBehavior.NativeIdentifier or ValueBoundaryBehavior.CastNativeIdentifier))
{
if (MarshallerHelpers.IsMidlOutBehavior(marshaller.TypeInfo, context))
{
string outlocal = context.GetAdditionalIdentifier(info, "out");
initializations.Add(MarshallerHelpers.CreateDiscardStatement(outlocal));
}
}
}
}

if (!marshallers.IsManagedVoidReturn)
{
// Declare variables for stub return value
AppendVariableDeclarations(variables, marshallers.ManagedReturnMarshaller, context, initializeToDefault: initializeDeclarations);
{
var marshaller = marshallers.ManagedReturnMarshaller;
var info = marshaller.TypeInfo;
jtschuster marked this conversation as resolved.
Show resolved Hide resolved
// We need to use the 'out' value - This should be removed once the ownership behavior is fixed
var boundaryBehavior = marshaller.Generator.GetValueBoundaryBehavior(info, context);
if (marshaller.Generator.UsesNativeIdentifier(marshaller.TypeInfo, context)
&& boundaryBehavior is not
(ValueBoundaryBehavior.NativeIdentifier or ValueBoundaryBehavior.CastNativeIdentifier))
{
if (MarshallerHelpers.IsMidlOutBehavior(marshaller.TypeInfo, context))
{
string outlocal = context.GetAdditionalIdentifier(info, "out");
initializations.Add(MarshallerHelpers.CreateDiscardStatement(outlocal));
}
}
}
}

if (!marshallers.IsUnmanagedVoidReturn && !marshallers.ManagedNativeSameReturn)
Expand All @@ -112,6 +146,7 @@ static void AppendVariableDeclarations(ImmutableArray<LocalDeclarationStatementS
{
(string managed, string native) = context.GetIdentifiers(marshaller.TypeInfo);

var info = marshaller.TypeInfo;
jtschuster marked this conversation as resolved.
Show resolved Hide resolved
// Declare variable for return value
if (marshaller.TypeInfo.IsNativeReturnPosition)
{
Expand Down Expand Up @@ -143,14 +178,17 @@ static void AppendVariableDeclarations(ImmutableArray<LocalDeclarationStatementS
(ValueBoundaryBehavior.NativeIdentifier or ValueBoundaryBehavior.CastNativeIdentifier))
{
TypeSyntax localType = marshaller.Generator.AsNativeType(marshaller.TypeInfo).Syntax;
if (boundaryBehavior != ValueBoundaryBehavior.AddressOfNativeIdentifier)
if (MarshallerHelpers.IsMidlOutBehavior(marshaller.TypeInfo, context))
{
string outlocal = context.GetAdditionalIdentifier(info, "out");
// <nativeType> __param_native_out;
statementsToUpdate.Add(MarshallerHelpers.Declare(
localType,
native,
false));
marshaller.Generator.AsNativeType(info).Syntax,
outlocal,
true));
}
else

if (boundaryBehavior is ValueBoundaryBehavior.AddressOfNativeIdentifier)
{
// To simplify propogating back the value to the "byref" parameter,
// we'll just declare the native identifier as a ref to its type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,8 @@
public void Set(int value) => _data = value;
}

[GeneratedComInterface]
[Guid("5A9D3ED6-CC17-4FB9-8F82-0070489B7213")]
internal partial interface IBool
{
[return: MarshalAs(UnmanagedType.I1)]
bool Get();
void Set([MarshalAs(UnmanagedType.I1)] bool value);
}

[GeneratedComClass]
internal partial class IBoolImpl : IBool

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux_musl arm64 Release)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux_musl arm64 Release)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux arm Release)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux arm Release)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux_musl arm Release)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux_musl arm Release)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux_musl x64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux_musl x64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux arm64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux arm64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux x64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build linux x64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build osx x64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build osx x64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build osx arm64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,32): error SYSLIB1095: (NETCORE_ENGINEERING_TELEMETRY=Build) Class 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for 'ComInterfaceGenerator.Tests.ComInterfaces.IBoolImpl'.

Check failure on line 185 in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs

View check run for this annotation

Azure Pipelines / runtime (Build Libraries Build osx arm64 Debug)

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs#L185

src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs(185,44): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'IBool' could not be found (are you missing a using directive or an assembly reference?)
{
bool _data;
public bool Get() => _data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
'$(TargetOS)' == 'tvossimulator'">true</_TargetsAppleOS>
</PropertyGroup>

<Target Name="DisableComInterfaceGenerator"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment here about this target if we're going to merge it into main.

BeforeTargets="CoreCompile">
<ItemGroup>
<Analyzer Remove="@(Analyzer)" Condition="'%(FileName)' == 'Microsoft.Interop.ComInterfaceGenerator'" />
</ItemGroup>
</Target>

<ItemGroup>
<Compile Include="..\..\TestAssets\SharedTypes\ComInterfaces\**\*.cs" Link="ComInterfaceGenerator\ComInterfaces\%(RecursiveDir)\%(FileName).cs" />
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;

namespace SharedTypes.ComInterfaces
{
[GeneratedComInterface(StringMarshalling = System.Runtime.InteropServices.StringMarshalling.Utf8)]
[Guid(_guid)]
internal partial interface IRefStrings
{
public const string _guid = "5146B7DB-0588-469B-B8E5-B38090A2FC15";
jtschuster marked this conversation as resolved.
Show resolved Hide resolved
void RefString(ref string value);
void InString(in string value);
void OutString(out string value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
</ItemGroup>

<Target Name="DisableComInterfaceGenerator"
BeforeTargets="CoreCompile">
<ItemGroup>
<Analyzer Remove="@(Analyzer)" Condition="'%(FileName)' == 'Microsoft.Interop.ComInterfaceGenerator'" />
</ItemGroup>
</Target>

<ItemGroup>
<ProjectReference Include="..\..\Ancillary.Interop\Ancillary.Interop.csproj" />
</ItemGroup>
Expand Down
Loading