Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
53a4774
Add extensions to ITypeSymbol to determine blittability by the rules …
jkoritzinsky Aug 18, 2020
5416696
Start adding tests for the manual type marshalling analyzer.
jkoritzinsky Aug 19, 2020
75d3de3
Add more testing around the blittability verification.
jkoritzinsky Aug 19, 2020
c43614e
Add more validation in the analyzer and add testing of most of said v…
jkoritzinsky Aug 20, 2020
dd7afe8
Require native type to be a value type.
jkoritzinsky Aug 20, 2020
db5309b
Add basic testing of the MarshalUsing scenario
jkoritzinsky Aug 20, 2020
5c06d87
Update DllImportGenerator/DllImportGenerator/ManualTypeMarshallingAna…
jkoritzinsky Aug 24, 2020
001b2bd
Move diagnostic messages and descriptions into a resx.
jkoritzinsky Aug 25, 2020
05cafa2
Add underscores to make unit test names more readable.
jkoritzinsky Aug 25, 2020
769880e
Cache symbol lookup results and don't run the analyzer if a required …
jkoritzinsky Aug 25, 2020
634a744
Cache type names and quote them in resource strings.
jkoritzinsky Aug 25, 2020
0d526cb
Add test case with Char for completeness.
jkoritzinsky Aug 25, 2020
51b6f95
Add some basic tests around generics.
jkoritzinsky Aug 25, 2020
3903489
Add some tests around pointer fields.
jkoritzinsky Aug 25, 2020
a35b70f
Add a test for function pointer fields and enable prerelease language…
jkoritzinsky Aug 25, 2020
7ac6890
Enable nullability checking in TypeSymbolExtensions.
jkoritzinsky Aug 25, 2020
0dc885a
Update DllImportGenerator/DllImportGenerator/Resources.resx
jkoritzinsky Aug 31, 2020
83f5ad5
PR feedback.
jkoritzinsky Sep 1, 2020
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
@@ -0,0 +1,36 @@
#nullable enable

namespace System.Runtime.InteropServices
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
class GeneratedMarshallingAttribute : Attribute
{
}

[AttributeUsage(AttributeTargets.Struct)]
public class BlittableTypeAttribute : Attribute
{
}

[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class)]
public class NativeMarshallingAttribute : Attribute
{
public NativeMarshallingAttribute(Type nativeType)
{
NativeType = nativeType;
}

public Type NativeType { get; }
}

[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.Field)]
public class MarshalUsingAttribute : Attribute
{
public MarshalUsingAttribute(Type nativeType)
{
NativeType = nativeType;
}

public Type NativeType { get; }
}
}
5 changes: 3 additions & 2 deletions DllImportGenerator/DllImportGenerator.Test/CompileFails.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.CodeAnalysis;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;

namespace DllImportGenerator.Test
Expand All @@ -13,9 +14,9 @@ public static IEnumerable<object[]> CodeSnippetsToCompile()

[Theory]
[MemberData(nameof(CodeSnippetsToCompile))]
public void ValidateSnippets(string source, int failCount)
public async Task ValidateSnippets(string source, int failCount)
{
Compilation comp = TestUtils.CreateCompilation(source);
Compilation comp = await TestUtils.CreateCompilation(source);
TestUtils.AssertPreSourceGeneratorCompilation(comp);

var newComp = TestUtils.RunGenerators(comp, out var generatorDiags, new Microsoft.Interop.DllImportGenerator());
Expand Down
5 changes: 3 additions & 2 deletions DllImportGenerator/DllImportGenerator.Test/Compiles.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.CodeAnalysis;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;

namespace DllImportGenerator.Test
Expand All @@ -23,9 +24,9 @@ public static IEnumerable<object[]> CodeSnippetsToCompile()

[Theory]
[MemberData(nameof(CodeSnippetsToCompile))]
public void ValidateSnippets(string source)
public async Task ValidateSnippets(string source)
{
Compilation comp = TestUtils.CreateCompilation(source);
Compilation comp = await TestUtils.CreateCompilation(source);
TestUtils.AssertPreSourceGeneratorCompilation(comp);

var newComp = TestUtils.RunGenerators(comp, out var generatorDiags, new Microsoft.Interop.DllImportGenerator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.7.0-3.final" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.0-beta1.final" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.0.1-beta1.20418.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.7.0-3.final">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -29,5 +30,8 @@
<ProjectReference Include="..\Ancillary.Interop\Ancillary.Interop.csproj" />
<ProjectReference Include="..\DllImportGenerator\DllImportGenerator.csproj" />
</ItemGroup>


<PropertyGroup>
<RestoreAdditionalProjectSources>https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json ;$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
</PropertyGroup>
</Project>
Loading