diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/System.Runtime.InteropServices.JavaScript.sln b/src/libraries/System.Runtime.InteropServices.JavaScript/System.Runtime.InteropServices.JavaScript.sln index 9be1cf583e2740..322f5bf805e6b1 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/System.Runtime.InteropServices.JavaScript.sln +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/System.Runtime.InteropServices.JavaScript.sln @@ -1,4 +1,8 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35229.201 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Private.CoreLib", "..\..\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj", "{0F7BA062-C34C-41A8-840F-F0B074B18686}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}" @@ -73,16 +77,21 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{19EA33B4-0E8 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{1A04C5D7-1DE9-47C3-BCC1-147678B9085F}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "tools\gen", "{F81BA54D-38C5-4493-BB5C-344825706D3A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{F81BA54D-38C5-4493-BB5C-344825706D3A}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "tools\src", "{F0448246-E8A1-49FD-878C-7A6B8486A66B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F0448246-E8A1-49FD-878C-7A6B8486A66B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "tools\ref", "{9BB52E31-4890-4F4B-8B2B-6282EF13B8D2}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{9BB52E31-4890-4F4B-8B2B-6282EF13B8D2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{7392B838-42AF-4F54-AD02-366397DAF640}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Checked|Any CPU = Checked|Any CPU + Checked|arm = Checked|arm + Checked|arm64 = Checked|arm64 + Checked|x64 = Checked|x64 + Checked|x86 = Checked|x86 Debug|Any CPU = Debug|Any CPU Debug|arm = Debug|arm Debug|arm64 = Debug|arm64 @@ -93,13 +102,18 @@ Global Release|arm64 = Release|arm64 Release|x64 = Release|x64 Release|x86 = Release|x86 - Checked|Any CPU = Checked|Any CPU - Checked|arm = Checked|arm - Checked|arm64 = Checked|arm64 - Checked|x64 = Checked|x64 - Checked|x86 = Checked|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|Any CPU.ActiveCfg = Checked|x64 + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|Any CPU.Build.0 = Checked|x64 + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm.ActiveCfg = Checked|arm + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm.Build.0 = Checked|arm + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm64.ActiveCfg = Checked|arm64 + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm64.Build.0 = Checked|arm64 + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x64.ActiveCfg = Checked|x64 + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x64.Build.0 = Checked|x64 + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x86.ActiveCfg = Checked|x86 + {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x86.Build.0 = Checked|x86 {0F7BA062-C34C-41A8-840F-F0B074B18686}.Debug|Any CPU.ActiveCfg = Debug|x64 {0F7BA062-C34C-41A8-840F-F0B074B18686}.Debug|Any CPU.Build.0 = Debug|x64 {0F7BA062-C34C-41A8-840F-F0B074B18686}.Debug|arm.ActiveCfg = Debug|arm @@ -120,16 +134,11 @@ Global {0F7BA062-C34C-41A8-840F-F0B074B18686}.Release|x64.Build.0 = Release|x64 {0F7BA062-C34C-41A8-840F-F0B074B18686}.Release|x86.ActiveCfg = Release|x86 {0F7BA062-C34C-41A8-840F-F0B074B18686}.Release|x86.Build.0 = Release|x86 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|Any CPU.ActiveCfg = Checked|x64 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|Any CPU.Build.0 = Checked|x64 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm.ActiveCfg = Checked|arm - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm.Build.0 = Checked|arm - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm64.ActiveCfg = Checked|arm64 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|arm64.Build.0 = Checked|arm64 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x64.ActiveCfg = Checked|x64 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x64.Build.0 = Checked|x64 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x86.ActiveCfg = Checked|x86 - {0F7BA062-C34C-41A8-840F-F0B074B18686}.Checked|x86.Build.0 = Checked|x86 + {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|arm.ActiveCfg = Debug|Any CPU + {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|arm64.ActiveCfg = Debug|Any CPU + {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|x64.ActiveCfg = Debug|Any CPU + {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|x86.ActiveCfg = Debug|Any CPU {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Debug|Any CPU.Build.0 = Debug|Any CPU {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -146,11 +155,11 @@ Global {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Release|x64.Build.0 = Release|Any CPU {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Release|x86.ActiveCfg = Release|Any CPU {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Release|x86.Build.0 = Release|Any CPU - {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|arm.ActiveCfg = Debug|Any CPU - {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|arm64.ActiveCfg = Debug|Any CPU - {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|x64.ActiveCfg = Debug|Any CPU - {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272}.Checked|x86.ActiveCfg = Debug|Any CPU + {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|arm.ActiveCfg = Debug|Any CPU + {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|arm64.ActiveCfg = Debug|Any CPU + {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|x64.ActiveCfg = Debug|Any CPU + {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|x86.ActiveCfg = Debug|Any CPU {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -167,11 +176,11 @@ Global {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Release|x64.Build.0 = Release|Any CPU {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Release|x86.ActiveCfg = Release|Any CPU {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Release|x86.Build.0 = Release|Any CPU - {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|arm.ActiveCfg = Debug|Any CPU - {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|arm64.ActiveCfg = Debug|Any CPU - {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|x64.ActiveCfg = Debug|Any CPU - {FC1007CC-9E52-49B7-A47B-A8AE76E75986}.Checked|x86.ActiveCfg = Debug|Any CPU + {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|arm.ActiveCfg = Debug|Any CPU + {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|arm64.ActiveCfg = Debug|Any CPU + {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|x64.ActiveCfg = Debug|Any CPU + {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|x86.ActiveCfg = Debug|Any CPU {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -188,11 +197,11 @@ Global {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Release|x64.Build.0 = Release|Any CPU {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Release|x86.ActiveCfg = Release|Any CPU {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Release|x86.Build.0 = Release|Any CPU - {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|arm.ActiveCfg = Debug|Any CPU - {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|arm64.ActiveCfg = Debug|Any CPU - {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|x64.ActiveCfg = Debug|Any CPU - {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3}.Checked|x86.ActiveCfg = Debug|Any CPU + {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|arm.ActiveCfg = Debug|Any CPU + {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|arm64.ActiveCfg = Debug|Any CPU + {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|x64.ActiveCfg = Debug|Any CPU + {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|x86.ActiveCfg = Debug|Any CPU {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -209,11 +218,11 @@ Global {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Release|x64.Build.0 = Release|Any CPU {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Release|x86.ActiveCfg = Release|Any CPU {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Release|x86.Build.0 = Release|Any CPU - {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|arm.ActiveCfg = Debug|Any CPU - {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|arm64.ActiveCfg = Debug|Any CPU - {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|x64.ActiveCfg = Debug|Any CPU - {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB}.Checked|x86.ActiveCfg = Debug|Any CPU + {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|arm.ActiveCfg = Debug|Any CPU + {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|arm64.ActiveCfg = Debug|Any CPU + {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|x64.ActiveCfg = Debug|Any CPU + {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|x86.ActiveCfg = Debug|Any CPU {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -230,11 +239,11 @@ Global {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Release|x64.Build.0 = Release|Any CPU {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Release|x86.ActiveCfg = Release|Any CPU {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Release|x86.Build.0 = Release|Any CPU - {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|arm.ActiveCfg = Debug|Any CPU - {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|arm64.ActiveCfg = Debug|Any CPU - {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|x64.ActiveCfg = Debug|Any CPU - {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8}.Checked|x86.ActiveCfg = Debug|Any CPU + {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|arm.ActiveCfg = Debug|Any CPU + {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|arm64.ActiveCfg = Debug|Any CPU + {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|x64.ActiveCfg = Debug|Any CPU + {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|x86.ActiveCfg = Debug|Any CPU {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Debug|Any CPU.Build.0 = Debug|Any CPU {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -251,11 +260,11 @@ Global {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Release|x64.Build.0 = Release|Any CPU {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Release|x86.ActiveCfg = Release|Any CPU {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Release|x86.Build.0 = Release|Any CPU - {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|arm.ActiveCfg = Debug|Any CPU - {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|arm64.ActiveCfg = Debug|Any CPU - {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|x64.ActiveCfg = Debug|Any CPU - {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE}.Checked|x86.ActiveCfg = Debug|Any CPU + {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|arm.ActiveCfg = Debug|Any CPU + {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|arm64.ActiveCfg = Debug|Any CPU + {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|x64.ActiveCfg = Debug|Any CPU + {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|x86.ActiveCfg = Debug|Any CPU {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -272,11 +281,11 @@ Global {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Release|x64.Build.0 = Release|Any CPU {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Release|x86.ActiveCfg = Release|Any CPU {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Release|x86.Build.0 = Release|Any CPU - {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|arm.ActiveCfg = Debug|Any CPU - {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|arm64.ActiveCfg = Debug|Any CPU - {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|x64.ActiveCfg = Debug|Any CPU - {8CFB1155-26A2-43E3-B192-1F87D9E543AC}.Checked|x86.ActiveCfg = Debug|Any CPU + {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|arm.ActiveCfg = Debug|Any CPU + {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|arm64.ActiveCfg = Debug|Any CPU + {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|x64.ActiveCfg = Debug|Any CPU + {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|x86.ActiveCfg = Debug|Any CPU {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Debug|Any CPU.Build.0 = Debug|Any CPU {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -293,11 +302,11 @@ Global {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Release|x64.Build.0 = Release|Any CPU {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Release|x86.ActiveCfg = Release|Any CPU {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Release|x86.Build.0 = Release|Any CPU - {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|arm.ActiveCfg = Debug|Any CPU - {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|arm64.ActiveCfg = Debug|Any CPU - {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|x64.ActiveCfg = Debug|Any CPU - {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08}.Checked|x86.ActiveCfg = Debug|Any CPU + {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|arm.ActiveCfg = Debug|Any CPU + {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|arm64.ActiveCfg = Debug|Any CPU + {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|x64.ActiveCfg = Debug|Any CPU + {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|x86.ActiveCfg = Debug|Any CPU {74143A5F-6987-4AB5-B786-DE358F01241B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {74143A5F-6987-4AB5-B786-DE358F01241B}.Debug|Any CPU.Build.0 = Debug|Any CPU {74143A5F-6987-4AB5-B786-DE358F01241B}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -314,11 +323,11 @@ Global {74143A5F-6987-4AB5-B786-DE358F01241B}.Release|x64.Build.0 = Release|Any CPU {74143A5F-6987-4AB5-B786-DE358F01241B}.Release|x86.ActiveCfg = Release|Any CPU {74143A5F-6987-4AB5-B786-DE358F01241B}.Release|x86.Build.0 = Release|Any CPU - {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|arm.ActiveCfg = Debug|Any CPU - {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|arm64.ActiveCfg = Debug|Any CPU - {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|x64.ActiveCfg = Debug|Any CPU - {74143A5F-6987-4AB5-B786-DE358F01241B}.Checked|x86.ActiveCfg = Debug|Any CPU + {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|arm.ActiveCfg = Debug|Any CPU + {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|arm64.ActiveCfg = Debug|Any CPU + {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|x64.ActiveCfg = Debug|Any CPU + {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|x86.ActiveCfg = Debug|Any CPU {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -335,11 +344,11 @@ Global {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Release|x64.Build.0 = Release|Any CPU {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Release|x86.ActiveCfg = Release|Any CPU {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Release|x86.Build.0 = Release|Any CPU - {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|arm.ActiveCfg = Debug|Any CPU - {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|arm64.ActiveCfg = Debug|Any CPU - {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|x64.ActiveCfg = Debug|Any CPU - {CE5E53C1-F9B5-41EE-8D00-837913EC57D1}.Checked|x86.ActiveCfg = Debug|Any CPU + {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|arm.ActiveCfg = Debug|Any CPU + {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|arm64.ActiveCfg = Debug|Any CPU + {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|x64.ActiveCfg = Debug|Any CPU + {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|x86.ActiveCfg = Debug|Any CPU {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Debug|Any CPU.Build.0 = Debug|Any CPU {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -356,11 +365,11 @@ Global {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Release|x64.Build.0 = Release|Any CPU {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Release|x86.ActiveCfg = Release|Any CPU {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Release|x86.Build.0 = Release|Any CPU - {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|arm.ActiveCfg = Debug|Any CPU - {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|arm64.ActiveCfg = Debug|Any CPU - {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|x64.ActiveCfg = Debug|Any CPU - {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1}.Checked|x86.ActiveCfg = Debug|Any CPU + {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|arm.ActiveCfg = Debug|Any CPU + {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|arm64.ActiveCfg = Debug|Any CPU + {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|x64.ActiveCfg = Debug|Any CPU + {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|x86.ActiveCfg = Debug|Any CPU {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Debug|Any CPU.Build.0 = Debug|Any CPU {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -377,11 +386,11 @@ Global {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Release|x64.Build.0 = Release|Any CPU {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Release|x86.ActiveCfg = Release|Any CPU {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Release|x86.Build.0 = Release|Any CPU - {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|arm.ActiveCfg = Debug|Any CPU - {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|arm64.ActiveCfg = Debug|Any CPU - {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|x64.ActiveCfg = Debug|Any CPU - {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45}.Checked|x86.ActiveCfg = Debug|Any CPU + {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|arm.ActiveCfg = Debug|Any CPU + {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|arm64.ActiveCfg = Debug|Any CPU + {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|x64.ActiveCfg = Debug|Any CPU + {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|x86.ActiveCfg = Debug|Any CPU {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Debug|Any CPU.Build.0 = Debug|Any CPU {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -398,11 +407,11 @@ Global {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Release|x64.Build.0 = Release|Any CPU {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Release|x86.ActiveCfg = Release|Any CPU {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Release|x86.Build.0 = Release|Any CPU - {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|arm.ActiveCfg = Debug|Any CPU - {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|arm64.ActiveCfg = Debug|Any CPU - {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|x64.ActiveCfg = Debug|Any CPU - {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9}.Checked|x86.ActiveCfg = Debug|Any CPU + {BFED925C-18F2-4C98-833E-66F205234598}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {BFED925C-18F2-4C98-833E-66F205234598}.Checked|arm.ActiveCfg = Debug|Any CPU + {BFED925C-18F2-4C98-833E-66F205234598}.Checked|arm64.ActiveCfg = Debug|Any CPU + {BFED925C-18F2-4C98-833E-66F205234598}.Checked|x64.ActiveCfg = Debug|Any CPU + {BFED925C-18F2-4C98-833E-66F205234598}.Checked|x86.ActiveCfg = Debug|Any CPU {BFED925C-18F2-4C98-833E-66F205234598}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BFED925C-18F2-4C98-833E-66F205234598}.Debug|Any CPU.Build.0 = Debug|Any CPU {BFED925C-18F2-4C98-833E-66F205234598}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -419,11 +428,11 @@ Global {BFED925C-18F2-4C98-833E-66F205234598}.Release|x64.Build.0 = Release|Any CPU {BFED925C-18F2-4C98-833E-66F205234598}.Release|x86.ActiveCfg = Release|Any CPU {BFED925C-18F2-4C98-833E-66F205234598}.Release|x86.Build.0 = Release|Any CPU - {BFED925C-18F2-4C98-833E-66F205234598}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {BFED925C-18F2-4C98-833E-66F205234598}.Checked|arm.ActiveCfg = Debug|Any CPU - {BFED925C-18F2-4C98-833E-66F205234598}.Checked|arm64.ActiveCfg = Debug|Any CPU - {BFED925C-18F2-4C98-833E-66F205234598}.Checked|x64.ActiveCfg = Debug|Any CPU - {BFED925C-18F2-4C98-833E-66F205234598}.Checked|x86.ActiveCfg = Debug|Any CPU + {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|arm.ActiveCfg = Debug|Any CPU + {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|arm64.ActiveCfg = Debug|Any CPU + {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|x64.ActiveCfg = Debug|Any CPU + {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|x86.ActiveCfg = Debug|Any CPU {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Debug|Any CPU.Build.0 = Debug|Any CPU {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -440,11 +449,11 @@ Global {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Release|x64.Build.0 = Release|Any CPU {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Release|x86.ActiveCfg = Release|Any CPU {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Release|x86.Build.0 = Release|Any CPU - {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|arm.ActiveCfg = Debug|Any CPU - {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|arm64.ActiveCfg = Debug|Any CPU - {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|x64.ActiveCfg = Debug|Any CPU - {765B4AA5-723A-44FF-BC4E-EB0F03103F6D}.Checked|x86.ActiveCfg = Debug|Any CPU + {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|arm.ActiveCfg = Debug|Any CPU + {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|arm64.ActiveCfg = Debug|Any CPU + {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|x64.ActiveCfg = Debug|Any CPU + {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|x86.ActiveCfg = Debug|Any CPU {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -461,11 +470,11 @@ Global {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Release|x64.Build.0 = Release|Any CPU {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Release|x86.ActiveCfg = Release|Any CPU {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Release|x86.Build.0 = Release|Any CPU - {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|arm.ActiveCfg = Debug|Any CPU - {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|arm64.ActiveCfg = Debug|Any CPU - {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|x64.ActiveCfg = Debug|Any CPU - {DE207B2C-A0CC-47C8-AC20-46A8C0970287}.Checked|x86.ActiveCfg = Debug|Any CPU + {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|arm.ActiveCfg = Debug|Any CPU + {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|arm64.ActiveCfg = Debug|Any CPU + {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|x64.ActiveCfg = Debug|Any CPU + {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|x86.ActiveCfg = Debug|Any CPU {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -482,11 +491,11 @@ Global {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Release|x64.Build.0 = Release|Any CPU {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Release|x86.ActiveCfg = Release|Any CPU {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Release|x86.Build.0 = Release|Any CPU - {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|arm.ActiveCfg = Debug|Any CPU - {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|arm64.ActiveCfg = Debug|Any CPU - {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|x64.ActiveCfg = Debug|Any CPU - {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD}.Checked|x86.ActiveCfg = Debug|Any CPU + {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|arm.ActiveCfg = Debug|Any CPU + {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|arm64.ActiveCfg = Debug|Any CPU + {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|x64.ActiveCfg = Debug|Any CPU + {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|x86.ActiveCfg = Debug|Any CPU {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Debug|Any CPU.Build.0 = Debug|Any CPU {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -503,11 +512,11 @@ Global {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Release|x64.Build.0 = Release|Any CPU {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Release|x86.ActiveCfg = Release|Any CPU {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Release|x86.Build.0 = Release|Any CPU - {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|arm.ActiveCfg = Debug|Any CPU - {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|arm64.ActiveCfg = Debug|Any CPU - {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|x64.ActiveCfg = Debug|Any CPU - {B4E3E774-2C16-4CBF-87EF-88C547529B94}.Checked|x86.ActiveCfg = Debug|Any CPU + {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|arm.ActiveCfg = Debug|Any CPU + {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|arm64.ActiveCfg = Debug|Any CPU + {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|x64.ActiveCfg = Debug|Any CPU + {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|x86.ActiveCfg = Debug|Any CPU {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Debug|Any CPU.Build.0 = Debug|Any CPU {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -524,11 +533,11 @@ Global {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Release|x64.Build.0 = Release|Any CPU {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Release|x86.ActiveCfg = Release|Any CPU {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Release|x86.Build.0 = Release|Any CPU - {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|arm.ActiveCfg = Debug|Any CPU - {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|arm64.ActiveCfg = Debug|Any CPU - {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|x64.ActiveCfg = Debug|Any CPU - {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532}.Checked|x86.ActiveCfg = Debug|Any CPU + {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|arm.ActiveCfg = Debug|Any CPU + {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|arm64.ActiveCfg = Debug|Any CPU + {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|x64.ActiveCfg = Debug|Any CPU + {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|x86.ActiveCfg = Debug|Any CPU {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Debug|Any CPU.Build.0 = Debug|Any CPU {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -545,11 +554,11 @@ Global {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Release|x64.Build.0 = Release|Any CPU {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Release|x86.ActiveCfg = Release|Any CPU {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Release|x86.Build.0 = Release|Any CPU - {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|arm.ActiveCfg = Debug|Any CPU - {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|arm64.ActiveCfg = Debug|Any CPU - {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|x64.ActiveCfg = Debug|Any CPU - {44BAE6F1-94C2-415B-9A16-3B8EC429B09B}.Checked|x86.ActiveCfg = Debug|Any CPU + {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|arm.ActiveCfg = Debug|Any CPU + {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|arm64.ActiveCfg = Debug|Any CPU + {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|x64.ActiveCfg = Debug|Any CPU + {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|x86.ActiveCfg = Debug|Any CPU {1EB2EBE2-12EA-4545-B390-098F083329A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1EB2EBE2-12EA-4545-B390-098F083329A1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1EB2EBE2-12EA-4545-B390-098F083329A1}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -566,11 +575,11 @@ Global {1EB2EBE2-12EA-4545-B390-098F083329A1}.Release|x64.Build.0 = Release|Any CPU {1EB2EBE2-12EA-4545-B390-098F083329A1}.Release|x86.ActiveCfg = Release|Any CPU {1EB2EBE2-12EA-4545-B390-098F083329A1}.Release|x86.Build.0 = Release|Any CPU - {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|arm.ActiveCfg = Debug|Any CPU - {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|arm64.ActiveCfg = Debug|Any CPU - {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|x64.ActiveCfg = Debug|Any CPU - {1EB2EBE2-12EA-4545-B390-098F083329A1}.Checked|x86.ActiveCfg = Debug|Any CPU + {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|arm.ActiveCfg = Debug|Any CPU + {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|arm64.ActiveCfg = Debug|Any CPU + {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|x64.ActiveCfg = Debug|Any CPU + {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|x86.ActiveCfg = Debug|Any CPU {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -587,11 +596,11 @@ Global {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Release|x64.Build.0 = Release|Any CPU {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Release|x86.ActiveCfg = Release|Any CPU {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Release|x86.Build.0 = Release|Any CPU - {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|arm.ActiveCfg = Debug|Any CPU - {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|arm64.ActiveCfg = Debug|Any CPU - {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|x64.ActiveCfg = Debug|Any CPU - {B18C5A3A-CAB0-4B62-9C01-7A046E05089F}.Checked|x86.ActiveCfg = Debug|Any CPU + {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|arm.ActiveCfg = Debug|Any CPU + {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|arm64.ActiveCfg = Debug|Any CPU + {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|x64.ActiveCfg = Debug|Any CPU + {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|x86.ActiveCfg = Debug|Any CPU {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Debug|Any CPU.Build.0 = Debug|Any CPU {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -608,11 +617,11 @@ Global {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Release|x64.Build.0 = Release|Any CPU {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Release|x86.ActiveCfg = Release|Any CPU {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Release|x86.Build.0 = Release|Any CPU - {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|arm.ActiveCfg = Debug|Any CPU - {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|arm64.ActiveCfg = Debug|Any CPU - {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|x64.ActiveCfg = Debug|Any CPU - {04A40E6C-DD10-473D-AFF8-9033E936DC46}.Checked|x86.ActiveCfg = Debug|Any CPU + {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|arm.ActiveCfg = Debug|Any CPU + {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|arm64.ActiveCfg = Debug|Any CPU + {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|x64.ActiveCfg = Debug|Any CPU + {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|x86.ActiveCfg = Debug|Any CPU {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Debug|Any CPU.Build.0 = Debug|Any CPU {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -629,11 +638,11 @@ Global {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Release|x64.Build.0 = Release|Any CPU {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Release|x86.ActiveCfg = Release|Any CPU {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Release|x86.Build.0 = Release|Any CPU - {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|arm.ActiveCfg = Debug|Any CPU - {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|arm64.ActiveCfg = Debug|Any CPU - {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|x64.ActiveCfg = Debug|Any CPU - {B86E4599-88CF-4662-96BA-3FCB926D0BA1}.Checked|x86.ActiveCfg = Debug|Any CPU + {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|arm.ActiveCfg = Debug|Any CPU + {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|arm64.ActiveCfg = Debug|Any CPU + {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|x64.ActiveCfg = Debug|Any CPU + {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|x86.ActiveCfg = Debug|Any CPU {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Debug|Any CPU.Build.0 = Debug|Any CPU {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -650,11 +659,11 @@ Global {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Release|x64.Build.0 = Release|Any CPU {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Release|x86.ActiveCfg = Release|Any CPU {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Release|x86.Build.0 = Release|Any CPU - {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|arm.ActiveCfg = Debug|Any CPU - {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|arm64.ActiveCfg = Debug|Any CPU - {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|x64.ActiveCfg = Debug|Any CPU - {424A7718-F5B7-41FB-A74B-1E23A9BF13EA}.Checked|x86.ActiveCfg = Debug|Any CPU + {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|arm.ActiveCfg = Debug|Any CPU + {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|arm64.ActiveCfg = Debug|Any CPU + {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|x64.ActiveCfg = Debug|Any CPU + {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|x86.ActiveCfg = Debug|Any CPU {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Debug|Any CPU.Build.0 = Debug|Any CPU {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -671,11 +680,11 @@ Global {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Release|x64.Build.0 = Release|Any CPU {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Release|x86.ActiveCfg = Release|Any CPU {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Release|x86.Build.0 = Release|Any CPU - {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|arm.ActiveCfg = Debug|Any CPU - {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|arm64.ActiveCfg = Debug|Any CPU - {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|x64.ActiveCfg = Debug|Any CPU - {D620CBA3-326B-4E4A-81C2-3D9E9258E45C}.Checked|x86.ActiveCfg = Debug|Any CPU + {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|arm.ActiveCfg = Debug|Any CPU + {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|arm64.ActiveCfg = Debug|Any CPU + {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|x64.ActiveCfg = Debug|Any CPU + {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|x86.ActiveCfg = Debug|Any CPU {8683B814-5459-4412-A881-ECAFF9ED1781}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8683B814-5459-4412-A881-ECAFF9ED1781}.Debug|Any CPU.Build.0 = Debug|Any CPU {8683B814-5459-4412-A881-ECAFF9ED1781}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -692,11 +701,11 @@ Global {8683B814-5459-4412-A881-ECAFF9ED1781}.Release|x64.Build.0 = Release|Any CPU {8683B814-5459-4412-A881-ECAFF9ED1781}.Release|x86.ActiveCfg = Release|Any CPU {8683B814-5459-4412-A881-ECAFF9ED1781}.Release|x86.Build.0 = Release|Any CPU - {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|arm.ActiveCfg = Debug|Any CPU - {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|arm64.ActiveCfg = Debug|Any CPU - {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|x64.ActiveCfg = Debug|Any CPU - {8683B814-5459-4412-A881-ECAFF9ED1781}.Checked|x86.ActiveCfg = Debug|Any CPU + {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|arm.ActiveCfg = Debug|Any CPU + {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|arm64.ActiveCfg = Debug|Any CPU + {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|x64.ActiveCfg = Debug|Any CPU + {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|x86.ActiveCfg = Debug|Any CPU {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Debug|Any CPU.Build.0 = Debug|Any CPU {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -713,11 +722,11 @@ Global {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Release|x64.Build.0 = Release|Any CPU {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Release|x86.ActiveCfg = Release|Any CPU {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Release|x86.Build.0 = Release|Any CPU - {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|arm.ActiveCfg = Debug|Any CPU - {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|arm64.ActiveCfg = Debug|Any CPU - {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|x64.ActiveCfg = Debug|Any CPU - {4D8B7538-D933-4F3A-818D-4E19ABA7E182}.Checked|x86.ActiveCfg = Debug|Any CPU + {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|arm.ActiveCfg = Debug|Any CPU + {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|arm64.ActiveCfg = Debug|Any CPU + {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|x64.ActiveCfg = Debug|Any CPU + {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|x86.ActiveCfg = Debug|Any CPU {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Debug|Any CPU.Build.0 = Debug|Any CPU {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -734,11 +743,11 @@ Global {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Release|x64.Build.0 = Release|Any CPU {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Release|x86.ActiveCfg = Release|Any CPU {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Release|x86.Build.0 = Release|Any CPU - {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|arm.ActiveCfg = Debug|Any CPU - {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|arm64.ActiveCfg = Debug|Any CPU - {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|x64.ActiveCfg = Debug|Any CPU - {6C60944F-4FE1-450F-884B-D523EDFCFAB3}.Checked|x86.ActiveCfg = Debug|Any CPU + {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|arm.ActiveCfg = Debug|Any CPU + {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|arm64.ActiveCfg = Debug|Any CPU + {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|x64.ActiveCfg = Debug|Any CPU + {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|x86.ActiveCfg = Debug|Any CPU {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -755,11 +764,11 @@ Global {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Release|x64.Build.0 = Release|Any CPU {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Release|x86.ActiveCfg = Release|Any CPU {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Release|x86.Build.0 = Release|Any CPU - {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|arm.ActiveCfg = Debug|Any CPU - {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|arm64.ActiveCfg = Debug|Any CPU - {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|x64.ActiveCfg = Debug|Any CPU - {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B}.Checked|x86.ActiveCfg = Debug|Any CPU + {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|arm.ActiveCfg = Debug|Any CPU + {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|arm64.ActiveCfg = Debug|Any CPU + {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|x64.ActiveCfg = Debug|Any CPU + {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|x86.ActiveCfg = Debug|Any CPU {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Debug|Any CPU.Build.0 = Debug|Any CPU {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -776,11 +785,11 @@ Global {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Release|x64.Build.0 = Release|Any CPU {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Release|x86.ActiveCfg = Release|Any CPU {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Release|x86.Build.0 = Release|Any CPU - {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|arm.ActiveCfg = Debug|Any CPU - {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|arm64.ActiveCfg = Debug|Any CPU - {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|x64.ActiveCfg = Debug|Any CPU - {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A}.Checked|x86.ActiveCfg = Debug|Any CPU + {008873D5-9028-4FF3-8354-71F713748625}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {008873D5-9028-4FF3-8354-71F713748625}.Checked|arm.ActiveCfg = Debug|Any CPU + {008873D5-9028-4FF3-8354-71F713748625}.Checked|arm64.ActiveCfg = Debug|Any CPU + {008873D5-9028-4FF3-8354-71F713748625}.Checked|x64.ActiveCfg = Debug|Any CPU + {008873D5-9028-4FF3-8354-71F713748625}.Checked|x86.ActiveCfg = Debug|Any CPU {008873D5-9028-4FF3-8354-71F713748625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {008873D5-9028-4FF3-8354-71F713748625}.Debug|Any CPU.Build.0 = Debug|Any CPU {008873D5-9028-4FF3-8354-71F713748625}.Debug|arm.ActiveCfg = Debug|Any CPU @@ -797,54 +806,54 @@ Global {008873D5-9028-4FF3-8354-71F713748625}.Release|x64.Build.0 = Release|Any CPU {008873D5-9028-4FF3-8354-71F713748625}.Release|x86.ActiveCfg = Release|Any CPU {008873D5-9028-4FF3-8354-71F713748625}.Release|x86.Build.0 = Release|Any CPU - {008873D5-9028-4FF3-8354-71F713748625}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {008873D5-9028-4FF3-8354-71F713748625}.Checked|arm.ActiveCfg = Debug|Any CPU - {008873D5-9028-4FF3-8354-71F713748625}.Checked|arm64.ActiveCfg = Debug|Any CPU - {008873D5-9028-4FF3-8354-71F713748625}.Checked|x64.ActiveCfg = Debug|Any CPU - {008873D5-9028-4FF3-8354-71F713748625}.Checked|x86.ActiveCfg = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {0F7BA062-C34C-41A8-840F-F0B074B18686} = {32733782-56D6-4EAF-B94E-5D10C759DD57} + {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272} = {26A72FFB-871A-4F2F-A513-B2F6E09F358C} {FC1007CC-9E52-49B7-A47B-A8AE76E75986} = {32733782-56D6-4EAF-B94E-5D10C759DD57} + {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3} = {19EA33B4-0E87-451F-95E3-8F3959117654} {B79E5BB4-2595-48BC-A44C-0A7949AFBDEB} = {32733782-56D6-4EAF-B94E-5D10C759DD57} + {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8} = {19EA33B4-0E87-451F-95E3-8F3959117654} {C1C606F3-A246-4EA0-A467-3AC4F31C2AFE} = {32733782-56D6-4EAF-B94E-5D10C759DD57} + {8CFB1155-26A2-43E3-B192-1F87D9E543AC} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} + {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08} = {19EA33B4-0E87-451F-95E3-8F3959117654} {74143A5F-6987-4AB5-B786-DE358F01241B} = {32733782-56D6-4EAF-B94E-5D10C759DD57} + {CE5E53C1-F9B5-41EE-8D00-837913EC57D1} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} + {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1} = {19EA33B4-0E87-451F-95E3-8F3959117654} {71A845ED-4344-41FC-8FCA-3AC9B6BA6C45} = {32733782-56D6-4EAF-B94E-5D10C759DD57} - {1EB2EBE2-12EA-4545-B390-098F083329A1} = {32733782-56D6-4EAF-B94E-5D10C759DD57} - {04A40E6C-DD10-473D-AFF8-9033E936DC46} = {32733782-56D6-4EAF-B94E-5D10C759DD57} - {424A7718-F5B7-41FB-A74B-1E23A9BF13EA} = {32733782-56D6-4EAF-B94E-5D10C759DD57} - {8683B814-5459-4412-A881-ECAFF9ED1781} = {32733782-56D6-4EAF-B94E-5D10C759DD57} - {ED86AB26-1CFB-457D-BF87-B7A0D8FAF272} = {26A72FFB-871A-4F2F-A513-B2F6E09F358C} {E6A30001-84E3-4C7A-9B56-B9DEA71B3CF9} = {26A72FFB-871A-4F2F-A513-B2F6E09F358C} {BFED925C-18F2-4C98-833E-66F205234598} = {26A72FFB-871A-4F2F-A513-B2F6E09F358C} {765B4AA5-723A-44FF-BC4E-EB0F03103F6D} = {26A72FFB-871A-4F2F-A513-B2F6E09F358C} + {DE207B2C-A0CC-47C8-AC20-46A8C0970287} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} + {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} + {B4E3E774-2C16-4CBF-87EF-88C547529B94} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} {EC3ADEFA-1FF3-482C-8CCB-FE4C77292532} = {26A72FFB-871A-4F2F-A513-B2F6E09F358C} - {8B1D80E9-AE0D-4E3C-9F91-E6862B49AEF3} = {19EA33B4-0E87-451F-95E3-8F3959117654} - {E00AE8BB-7C7F-4D07-949D-EDCC815AC8C8} = {19EA33B4-0E87-451F-95E3-8F3959117654} - {D549C13B-FC0D-4B5A-B50D-8F74CB5A3D08} = {19EA33B4-0E87-451F-95E3-8F3959117654} - {28278E01-BF5C-4AB6-AA7A-8DD4E6C04DB1} = {19EA33B4-0E87-451F-95E3-8F3959117654} {44BAE6F1-94C2-415B-9A16-3B8EC429B09B} = {19EA33B4-0E87-451F-95E3-8F3959117654} + {1EB2EBE2-12EA-4545-B390-098F083329A1} = {32733782-56D6-4EAF-B94E-5D10C759DD57} {B18C5A3A-CAB0-4B62-9C01-7A046E05089F} = {19EA33B4-0E87-451F-95E3-8F3959117654} + {04A40E6C-DD10-473D-AFF8-9033E936DC46} = {32733782-56D6-4EAF-B94E-5D10C759DD57} {B86E4599-88CF-4662-96BA-3FCB926D0BA1} = {19EA33B4-0E87-451F-95E3-8F3959117654} + {424A7718-F5B7-41FB-A74B-1E23A9BF13EA} = {32733782-56D6-4EAF-B94E-5D10C759DD57} {D620CBA3-326B-4E4A-81C2-3D9E9258E45C} = {19EA33B4-0E87-451F-95E3-8F3959117654} - {8CFB1155-26A2-43E3-B192-1F87D9E543AC} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} - {CE5E53C1-F9B5-41EE-8D00-837913EC57D1} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} - {DE207B2C-A0CC-47C8-AC20-46A8C0970287} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} - {09AA6758-0BD3-4312-9C07-AE9F1D50A3AD} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} - {B4E3E774-2C16-4CBF-87EF-88C547529B94} = {1A04C5D7-1DE9-47C3-BCC1-147678B9085F} + {8683B814-5459-4412-A881-ECAFF9ED1781} = {32733782-56D6-4EAF-B94E-5D10C759DD57} {4D8B7538-D933-4F3A-818D-4E19ABA7E182} = {F81BA54D-38C5-4493-BB5C-344825706D3A} {6C60944F-4FE1-450F-884B-D523EDFCFAB3} = {F81BA54D-38C5-4493-BB5C-344825706D3A} - {F81BA54D-38C5-4493-BB5C-344825706D3A} = {7392B838-42AF-4F54-AD02-366397DAF640} {B8F2E56D-6571-466D-9EF2-9FCAD3FC6E5B} = {F0448246-E8A1-49FD-878C-7A6B8486A66B} {42F9A600-BEC3-4F87-97EE-38E0DCAABC5A} = {F0448246-E8A1-49FD-878C-7A6B8486A66B} - {F0448246-E8A1-49FD-878C-7A6B8486A66B} = {7392B838-42AF-4F54-AD02-366397DAF640} {008873D5-9028-4FF3-8354-71F713748625} = {9BB52E31-4890-4F4B-8B2B-6282EF13B8D2} + {F81BA54D-38C5-4493-BB5C-344825706D3A} = {7392B838-42AF-4F54-AD02-366397DAF640} + {F0448246-E8A1-49FD-878C-7A6B8486A66B} = {7392B838-42AF-4F54-AD02-366397DAF640} {9BB52E31-4890-4F4B-8B2B-6282EF13B8D2} = {7392B838-42AF-4F54-AD02-366397DAF640} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3FE64246-4AFA-424A-AE5D-7007E20451B5} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\System.Private.CoreLib\src\System.Private.CoreLib.Shared.projitems*{0f7ba062-c34c-41a8-840f-f0b074b18686}*SharedItemsImports = 5 + ..\..\tools\illink\src\ILLink.Shared\ILLink.Shared.projitems*{42f9a600-bec3-4f87-97ee-38e0dcaabc5a}*SharedItemsImports = 5 + ..\..\tools\illink\src\ILLink.Shared\ILLink.Shared.projitems*{6c60944f-4fe1-450f-884b-d523edfcfab3}*SharedItemsImports = 5 + EndGlobalSection EndGlobal diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs index a5475e27c70a46..5dd5fa98ceb1b4 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs @@ -14,6 +14,7 @@ internal static class Constants public const string JSFunctionSignatureGlobal = "global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding"; public const string JSMarshalerArgumentGlobal = "global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument"; + public const string JSMarshalerArgument = "System.Runtime.InteropServices.JavaScript.JSMarshalerArgument"; public const string ModuleInitializerAttributeGlobal = "global::System.Runtime.CompilerServices.ModuleInitializerAttribute"; public const string CompilerGeneratedAttributeGlobal = "global::System.Runtime.CompilerServices.CompilerGeneratedAttribute"; public const string DynamicDependencyAttributeGlobal = "global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute"; diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportCodeGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportCodeGenerator.cs deleted file mode 100644 index 33b08510d4fe8a..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportCodeGenerator.cs +++ /dev/null @@ -1,236 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Microsoft.Interop.JavaScript -{ - internal sealed class JSExportCodeGenerator : JSCodeGenerator - { - private readonly BoundGenerators _marshallers; - - private readonly StubIdentifierContext _context; - private readonly JSExportData _jsExportData; - private readonly JSSignatureContext _signatureContext; - - public JSExportCodeGenerator( - ImmutableArray argTypes, - JSExportData attributeData, - JSSignatureContext signatureContext, - GeneratorDiagnosticsBag diagnosticsBag, - IMarshallingGeneratorResolver generatorResolver) - { - _signatureContext = signatureContext; - _jsExportData = attributeData; - - _marshallers = BoundGenerators.Create(argTypes, generatorResolver, StubCodeContext.DefaultNativeToManagedStub, new EmptyJSGenerator(), out var bindingFailures); - - diagnosticsBag.ReportGeneratorDiagnostics(bindingFailures); - - if (_marshallers.ManagedReturnMarshaller.UsesNativeIdentifier) - { - // If we need a different native return identifier, then recreate the context with the correct identifier before we generate any code. - _context = new DefaultIdentifierContext(ReturnIdentifier, ReturnNativeIdentifier, MarshalDirection.UnmanagedToManaged) - { - CodeEmitOptions = new(SkipInit: true), - }; - } - else - { - _context = new DefaultIdentifierContext(ReturnIdentifier, ReturnIdentifier, MarshalDirection.UnmanagedToManaged) - { - CodeEmitOptions = new(SkipInit: true), - }; - } - - // validate task + span mix - if (_marshallers.ManagedReturnMarshaller.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSTaskTypeInfo)) - { - IBoundMarshallingGenerator spanArg = _marshallers.SignatureMarshallers.FirstOrDefault(m => m.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSSpanTypeInfo)); - if (spanArg != default) - { - diagnosticsBag.ReportGeneratorDiagnostic(new GeneratorDiagnostic.NotSupported(spanArg.TypeInfo) - { - NotSupportedDetails = SR.SpanAndTaskNotSupported - }); - } - } - } - - public BlockSyntax GenerateJSExportBody() - { - List invoke = InvokeSyntax(); - GeneratedStatements statements = GeneratedStatements.Create(_marshallers, _context); - bool shouldInitializeVariables = !statements.GuaranteedUnmarshal.IsEmpty || !statements.CleanupCallerAllocated.IsEmpty || !statements.CleanupCalleeAllocated.IsEmpty; - VariableDeclarations declarations = VariableDeclarations.GenerateDeclarationsForUnmanagedToManaged(_marshallers, _context, shouldInitializeVariables); - - var setupStatements = new List(); - SetupSyntax(setupStatements); - - if (!(statements.GuaranteedUnmarshal.IsEmpty && statements.CleanupCalleeAllocated.IsEmpty)) - { - setupStatements.Add(SyntaxFactoryExtensions.Declare(PredefinedType(Token(SyntaxKind.BoolKeyword)), InvokeSucceededIdentifier, initializeToDefault: true)); - } - - setupStatements.AddRange(declarations.Initializations); - setupStatements.AddRange(declarations.Variables); - setupStatements.AddRange(statements.Setup); - - var tryStatements = new List(); - tryStatements.AddRange(statements.Unmarshal); - - tryStatements.AddRange(invoke); - - if (!(statements.GuaranteedUnmarshal.IsEmpty && statements.CleanupCalleeAllocated.IsEmpty)) - { - tryStatements.Add(ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, - IdentifierName(InvokeSucceededIdentifier), - LiteralExpression(SyntaxKind.TrueLiteralExpression)))); - } - - tryStatements.AddRange(statements.NotifyForSuccessfulInvoke); - tryStatements.AddRange(statements.PinnedMarshal); - tryStatements.AddRange(statements.Marshal); - - List allStatements = setupStatements; - - // Wrap unmarshall, invocation and return value marshalling in try-catch. - // In case of exception, marshal exception instead of return value. - var tryInvokeAndMarshal = TryStatement(SingletonList(CatchClause() - .WithDeclaration(CatchDeclaration(IdentifierName(Constants.ExceptionGlobal)).WithIdentifier(Identifier("ex"))) - .WithBlock(Block(SingletonList( - ExpressionStatement(InvocationExpression( - MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(Constants.ArgumentException), IdentifierName(Constants.ToJSMethod))) - .WithArgumentList(ArgumentList(SingletonSeparatedList(Argument(IdentifierName("ex"))))))))))) - .WithBlock(Block(tryStatements)); - - List finallyStatements = new List(); - if (!(statements.GuaranteedUnmarshal.IsEmpty && statements.CleanupCalleeAllocated.IsEmpty)) - { - finallyStatements.Add(IfStatement(IdentifierName(InvokeSucceededIdentifier), Block(statements.GuaranteedUnmarshal.Concat(statements.CleanupCalleeAllocated)))); - } - - finallyStatements.AddRange(statements.CleanupCallerAllocated); - - if (finallyStatements.Count > 0) - { - tryInvokeAndMarshal = TryStatement(Block(tryInvokeAndMarshal), default, FinallyClause(Block(finallyStatements))); - } - - allStatements.Add(tryInvokeAndMarshal); - - return Block(allStatements); - } - - public static StatementSyntax[] GenerateJSExportArchitectureCheck() - { - return new StatementSyntax[]{ - IfStatement( - BinaryExpression(SyntaxKind.LogicalOrExpression, - IdentifierName("initialized"), - BinaryExpression(SyntaxKind.NotEqualsExpression, - IdentifierName(Constants.OSArchitectureGlobal), - IdentifierName(Constants.ArchitectureWasmGlobal))), - ReturnStatement()), - ExpressionStatement( - AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, - IdentifierName("initialized"), - LiteralExpression(SyntaxKind.TrueLiteralExpression))), - }; - } - - public StatementSyntax GenerateJSExportRegistration() - { - var signatureArgs = new List - { - Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(_signatureContext.QualifiedMethodName))), - Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(_signatureContext.TypesHash))), - CreateSignaturesSyntax() - }; - - return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(Constants.JSFunctionSignatureGlobal), IdentifierName(Constants.BindCSFunctionMethod))) - .WithArgumentList(ArgumentList(SeparatedList(signatureArgs)))); - } - - private ArgumentSyntax CreateSignaturesSyntax() - { - IEnumerable types = _marshallers.ManagedReturnMarshaller is IJSMarshallingGenerator jsGen ? jsGen.GenerateBind() : []; - types = types - .Concat(_marshallers.NativeParameterMarshallers.OfType().SelectMany(p => p.GenerateBind())); - - return Argument(ArrayCreationExpression(ArrayType(IdentifierName(Constants.JSMarshalerTypeGlobal)) - .WithRankSpecifiers(SingletonList(ArrayRankSpecifier(SingletonSeparatedList(OmittedArraySizeExpression()))))) - .WithInitializer(InitializerExpression(SyntaxKind.ArrayInitializerExpression, SeparatedList(types)))); - } - - private void SetupSyntax(List statementsToUpdate) - { - foreach (IBoundMarshallingGenerator marshaller in _marshallers.NativeParameterMarshallers) - { - statementsToUpdate.Add(LocalDeclarationStatement(VariableDeclaration(marshaller.TypeInfo.ManagedType.Syntax) - .WithVariables(SingletonSeparatedList(VariableDeclarator(marshaller.TypeInfo.InstanceIdentifier))))); - } - - statementsToUpdate.Add(LocalDeclarationStatement(VariableDeclaration(RefType(IdentifierName(Constants.JSMarshalerArgumentGlobal))) - .WithVariables(SingletonSeparatedList(VariableDeclarator(Identifier(Constants.ArgumentException)) - .WithInitializer(EqualsValueClause(RefExpression(ElementAccessExpression(IdentifierName(Constants.ArgumentsBuffer)) - .WithArgumentList(BracketedArgumentList(SingletonSeparatedList( - Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0))))))))))))); - - statementsToUpdate.Add(LocalDeclarationStatement(VariableDeclaration(RefType(IdentifierName(Constants.JSMarshalerArgumentGlobal))) - .WithVariables(SingletonSeparatedList(VariableDeclarator(Identifier(Constants.ArgumentReturn)) - .WithInitializer(EqualsValueClause(RefExpression(ElementAccessExpression(IdentifierName(Constants.ArgumentsBuffer)) - .WithArgumentList(BracketedArgumentList(SingletonSeparatedList( - Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))))))))))); - } - - private List InvokeSyntax() - { - var statements = new List(); - var arguments = new List(); - - // Generate code for each parameter for the current stage - foreach (IBoundMarshallingGenerator marshaller in _marshallers.NativeParameterMarshallers) - { - // convert arguments for invocation - statements.AddRange(marshaller.Generate(_context)); - arguments.Add(Argument(IdentifierName(marshaller.TypeInfo.InstanceIdentifier))); - } - - if (_marshallers.IsManagedVoidReturn) - { - statements.Add(ExpressionStatement(InvocationExpression(IdentifierName(_signatureContext.MethodName)) - .WithArgumentList(ArgumentList(SeparatedList(arguments))))); - } - else - { - ExpressionSyntax invocation = InvocationExpression(IdentifierName(_signatureContext.MethodName)) - .WithArgumentList(ArgumentList(SeparatedList(arguments))); - - (string _, string nativeIdentifier) = _context.GetIdentifiers(_marshallers.ManagedReturnMarshaller.TypeInfo); - - ExpressionStatementSyntax statement = ExpressionStatement(AssignmentExpression( - SyntaxKind.SimpleAssignmentExpression, - IdentifierName(nativeIdentifier), invocation)); - - statements.Add(statement); - } - return statements; - - } - - public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateTargetMethodSignatureData() - { - return _marshallers.GenerateTargetMethodSignatureData(_context); - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs index 824bc6b6d6c05e..f5dfa0082aa9e9 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs @@ -146,7 +146,7 @@ private static MemberDeclarationSyntax PrintGeneratedSource( .WithAttributeLists(SingletonList(AttributeList(SingletonSeparatedList( Attribute(IdentifierName(Constants.DebuggerNonUserCodeAttribute)))))) .WithParameterList(ParameterList(SingletonSeparatedList( - Parameter(Identifier("__arguments_buffer")).WithType(PointerType(ParseTypeName(Constants.JSMarshalerArgumentGlobal)))))) + Parameter(Identifier(Constants.ArgumentsBuffer)).WithType(PointerType(ParseTypeName(Constants.JSMarshalerArgumentGlobal)))))) .WithBody(wrapperStatements); MemberDeclarationSyntax toPrint = containingSyntaxContext.WrapMembersInContainingSyntaxWithUnsafeModifier(wrappperMethod); @@ -225,7 +225,7 @@ private static NamespaceDeclarationSyntax GenerateRegSource( if (methods.IsEmpty) return NamespaceDeclaration(IdentifierName(generatedNamespace)); var registerStatements = new List(); - registerStatements.AddRange(JSExportCodeGenerator.GenerateJSExportArchitectureCheck()); + registerStatements.AddRange(GenerateJSExportArchitectureCheck()); var attributes = new List(); foreach (var m in methods) @@ -302,23 +302,76 @@ private static NamespaceDeclarationSyntax GenerateRegSource( return ns; } + private static StatementSyntax[] GenerateJSExportArchitectureCheck() + { + return [ + IfStatement( + BinaryExpression(SyntaxKind.LogicalOrExpression, + IdentifierName("initialized"), + BinaryExpression(SyntaxKind.NotEqualsExpression, + IdentifierName(Constants.OSArchitectureGlobal), + IdentifierName(Constants.ArchitectureWasmGlobal))), + ReturnStatement()), + ExpressionStatement( + AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName("initialized"), + LiteralExpression(SyntaxKind.TrueLiteralExpression))), + ]; + } + private static (MemberDeclarationSyntax, StatementSyntax, AttributeListSyntax, ImmutableArray) GenerateSource( IncrementalStubGenerationContext incrementalContext) { var diagnostics = new GeneratorDiagnosticsBag(new DescriptorProvider(), incrementalContext.DiagnosticLocation, SR.ResourceManager, typeof(FxResources.Microsoft.Interop.JavaScript.JSImportGenerator.SR)); // Generate stub code - var stubGenerator = new JSExportCodeGenerator( - incrementalContext.SignatureContext.SignatureContext.ElementTypeInformation, - incrementalContext.JSExportData, - incrementalContext.SignatureContext, + ImmutableArray signatureElements = incrementalContext.SignatureContext.SignatureContext.ElementTypeInformation; + + ImmutableArray allElements = signatureElements + .Add(new TypePositionInfo( + new ReferenceTypeInfo(Constants.ExceptionGlobal, Constants.ExceptionGlobal), + new JSMarshallingInfo(NoMarshallingInfo.Instance, new JSSimpleTypeInfo(KnownManagedType.Exception, ParseTypeName(Constants.ExceptionGlobal))) + { + JSType = System.Runtime.InteropServices.JavaScript.JSTypeFlags.Error, + }) + { + InstanceIdentifier = Constants.ArgumentException, + ManagedIndex = TypePositionInfo.ExceptionIndex, + NativeIndex = signatureElements.Length, // Insert at the end of the argument list + RefKind = RefKind.Out, // We'll treat it as a separate out parameter. + }); + + for (int i = 0; i < allElements.Length; i++) + { + if (allElements[i].IsNativeReturnPosition && allElements[i].ManagedType != SpecialTypeInfo.Void) + { + // The runtime may partially initialize the native return value. + // To preserve this information, we must pass the native return value as an out parameter. + allElements = allElements.SetItem(i, allElements[i] with + { + ManagedIndex = TypePositionInfo.ReturnIndex, + NativeIndex = allElements.Length, // Insert at the end of the argument list + RefKind = RefKind.Out, // We'll treat it as a separate out parameter. + }); + } + } + + var stubGenerator = new UnmanagedToManagedStubGenerator( + allElements, diagnostics, - new JSGeneratorResolver()); + new CompositeMarshallingGeneratorResolver( + new NoSpanAndTaskMixingResolver(), + new JSGeneratorResolver())); var wrapperName = "__Wrapper_" + incrementalContext.StubMethodSyntaxTemplate.Identifier + "_" + incrementalContext.SignatureContext.TypesHash; - BlockSyntax wrapper = stubGenerator.GenerateJSExportBody(); - StatementSyntax registration = stubGenerator.GenerateJSExportRegistration(); + const string innerWrapperName = "__Stub"; + + BlockSyntax wrapperToInnerStubBlock = Block( + CreateWrapperToInnerStubCall(signatureElements, innerWrapperName), + GenerateInnerLocalFunction(incrementalContext, innerWrapperName, stubGenerator)); + + StatementSyntax registration = GenerateJSExportRegistration(incrementalContext.SignatureContext); AttributeListSyntax registrationAttribute = AttributeList(SingletonSeparatedList(Attribute(IdentifierName(Constants.DynamicDependencyAttributeGlobal)) .WithArgumentList(AttributeArgumentList(SeparatedList(new[]{ AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(wrapperName))), @@ -327,11 +380,76 @@ private static (MemberDeclarationSyntax, StatementSyntax, AttributeListSyntax, I } ))))); - return (PrintGeneratedSource(incrementalContext.ContainingSyntaxContext, wrapper, wrapperName), + return (PrintGeneratedSource(incrementalContext.ContainingSyntaxContext, wrapperToInnerStubBlock, wrapperName), registration, registrationAttribute, incrementalContext.Diagnostics.Array.AddRange(diagnostics.Diagnostics)); } + private static ExpressionStatementSyntax CreateWrapperToInnerStubCall(ImmutableArray signatureElements, string innerWrapperName) + { + List arguments = []; + bool hasReturn = true; + foreach (var nativeArg in signatureElements.Where(e => e.NativeIndex != TypePositionInfo.UnsetIndex).OrderBy(e => e.NativeIndex)) + { + if (nativeArg.IsNativeReturnPosition) + { + if (nativeArg.ManagedType == SpecialTypeInfo.Void) + { + hasReturn = false; + } + continue; + } + arguments.Add( + Argument( + ElementAccessExpression( + IdentifierName(Constants.ArgumentsBuffer), + BracketedArgumentList(SingletonSeparatedList(Argument( + LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(nativeArg.NativeIndex + 2)))))))); + } + + arguments.Add(Argument(IdentifierName(Constants.ArgumentsBuffer))); + + if (hasReturn) + { + arguments.Add( + Argument( + BinaryExpression( + SyntaxKind.AddExpression, + IdentifierName(Constants.ArgumentsBuffer), + LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))); + } + + return ExpressionStatement( + InvocationExpression(IdentifierName(innerWrapperName)) + .WithArgumentList(ArgumentList(SeparatedList(arguments)))); + } + + private static LocalFunctionStatementSyntax GenerateInnerLocalFunction(IncrementalStubGenerationContext context, string innerFunctionName, UnmanagedToManagedStubGenerator stubGenerator) + { + var (parameters, returnType, _) = stubGenerator.GenerateAbiMethodSignatureData(); + return LocalFunctionStatement( + returnType, + innerFunctionName) + .WithBody(stubGenerator.GenerateStubBody(IdentifierName(context.SignatureContext.MethodName))) + .WithParameterList(parameters) + .WithAttributeLists(SingletonList(AttributeList(SingletonSeparatedList( + Attribute(IdentifierName(Constants.DebuggerNonUserCodeAttribute)))))); + } + + private static ExpressionStatementSyntax GenerateJSExportRegistration(JSSignatureContext context) + { + var signatureArgs = new List + { + Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(context.QualifiedMethodName))), + Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(context.TypesHash))), + SignatureBindingHelpers.CreateSignaturesArgument(context.SignatureContext.ElementTypeInformation, StubCodeContext.DefaultNativeToManagedStub) + }; + + return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, + IdentifierName(Constants.JSFunctionSignatureGlobal), IdentifierName(Constants.BindCSFunctionMethod))) + .WithArgumentList(ArgumentList(SeparatedList(signatureArgs)))); + } + private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method) { // Verify the method has no generic types or defined implementation diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs index f5f61c413bc117..51b6d5764b1b76 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSGeneratorFactory.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Data; +using Microsoft.CodeAnalysis.CSharp.Syntax; namespace Microsoft.Interop.JavaScript { @@ -16,7 +17,7 @@ internal sealed class JSGeneratorResolver : IMarshallingGeneratorResolver public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) { Debug.Assert(context != null); - if (info.IsByRef || info.ByValueContentsMarshalKind != ByValueContentsMarshalKind.Default) + if (!info.IsManagedExceptionPosition && !info.IsManagedReturnPosition && (info.IsByRef || info.ByValueContentsMarshalKind != ByValueContentsMarshalKind.Default)) { // out of scope for Net7.0 return ResolvedGenerator.NotSupported(info, context, new(info) @@ -24,298 +25,311 @@ public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) NotSupportedDetails = SR.InOutRefNotSupported }); } - JSMarshallingInfo jsMarshalingInfo = info.MarshallingAttributeInfo as JSMarshallingInfo; - ResolvedGenerator fail(string failReason) + if (MarshallerHelpers.GetMarshalDirection(info, context) != MarshalDirection.UnmanagedToManaged && info.ManagedIndex == TypePositionInfo.UnsetIndex) { - return ResolvedGenerator.NotSupported(info, context, new(info) - { - NotSupportedDetails = failReason - }); + // Use the InitOnlyJSGenerator for native-only parameters. + return ResolvedGenerator.Resolved(new ImplicitArgumentGenerator(info, context)); } - bool isToJs = info.ManagedIndex != TypePositionInfo.ReturnIndex ^ context.Direction == MarshalDirection.UnmanagedToManaged; + + return Create(info, info.MarshallingAttributeInfo as JSMarshallingInfo, context).Generator; + } + + public static (MarshalerType BaseType, IEnumerable? SubTypes) GetMarshallerTypeForBinding(TypePositionInfo info, StubCodeContext context) + { + var (_, baseType, subTypes) = Create(info, info.MarshallingAttributeInfo as JSMarshallingInfo, context); + return (baseType, subTypes); + } + + private record struct ResolvedGeneratorAndType(ResolvedGenerator Generator, MarshalerType Type, IEnumerable? SubTypes = null); + + private static ResolvedGeneratorAndType Create(TypePositionInfo info, JSMarshallingInfo jsMarshalingInfo, StubCodeContext context) + { + bool isToJs = MarshallerHelpers.GetMarshalDirection(info, context) == MarshalDirection.ManagedToUnmanaged; switch (jsMarshalingInfo) { // invalid case { TypeInfo: JSInvalidTypeInfo }: - return ResolvedGenerator.NotSupported(info, context, new(info)); - - // void - case { TypeInfo: JSSimpleTypeInfo(KnownManagedType.Void), JSType: JSTypeFlags.DiscardNoWait }: - return ResolvedGenerator.Resolved(new VoidGenerator(info, context, MarshalerType.DiscardNoWait)); - case { TypeInfo: JSSimpleTypeInfo(KnownManagedType.Void), JSType: JSTypeFlags.Discard }: - case { TypeInfo: JSSimpleTypeInfo(KnownManagedType.Void), JSType: JSTypeFlags.Void }: - case { TypeInfo: JSSimpleTypeInfo(KnownManagedType.Void), JSType: JSTypeFlags.None }: - case { TypeInfo: JSSimpleTypeInfo(KnownManagedType.Void), JSType: JSTypeFlags.Missing }: - return ResolvedGenerator.Resolved(new VoidGenerator(info, context, jsMarshalingInfo.JSType == JSTypeFlags.Void ? MarshalerType.Void : MarshalerType.Discard)); - - // discard no void - case { JSType: JSTypeFlags.Discard }: - return fail(SR.DiscardOnlyVoid); - - // oneway no void - case { JSType: JSTypeFlags.DiscardNoWait }: - return fail(SR.DiscardNoWaitOnlyVoid); + return new(ResolvedGenerator.NotSupported(info, context, new(info)), MarshalerType.None); // primitive case { TypeInfo: JSSimpleTypeInfo simple }: - return Create(info, context, isToJs, simple.KnownType, [], jsMarshalingInfo.JSType, Array.Empty(), fail); + return Create(info, context, isToJs, simple.KnownType, [], jsMarshalingInfo.JSType, []); // nullable case { TypeInfo: JSNullableTypeInfo nullable }: - return Create(info, context, isToJs, nullable.KnownType, [nullable.ResultTypeInfo.KnownType], jsMarshalingInfo.JSType, null, fail); + return Create(info, context, isToJs, nullable.KnownType, [nullable.ResultTypeInfo.KnownType], jsMarshalingInfo.JSType, null); // array case { TypeInfo: JSArrayTypeInfo array }: - return Create(info, context, isToJs, array.KnownType, [array.ElementTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments, fail); + return Create(info, context, isToJs, array.KnownType, [array.ElementTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments); // array segment case { TypeInfo: JSArraySegmentTypeInfo segment }: - return Create(info, context, isToJs, segment.KnownType, [segment.ElementTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments, fail); + return Create(info, context, isToJs, segment.KnownType, [segment.ElementTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments); // span case { TypeInfo: JSSpanTypeInfo span }: - return Create(info, context, isToJs, span.KnownType, [span.ElementTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments, fail); + return Create(info, context, isToJs, span.KnownType, [span.ElementTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments); // task case { TypeInfo: JSTaskTypeInfo(JSSimpleTypeInfo(KnownManagedType.Void)) task }: - return Create(info, context, isToJs, task.KnownType, [], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments, fail); + return Create(info, context, isToJs, task.KnownType, [], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments); case { TypeInfo: JSTaskTypeInfo task }: - return Create(info, context, isToJs, task.KnownType, [task.ResultTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments, fail); + return Create(info, context, isToJs, task.KnownType, [task.ResultTypeInfo.KnownType], jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments); // action + function case { TypeInfo: JSFunctionTypeInfo function }: - return Create(info, context, isToJs, function.KnownType, function.ArgsTypeInfo.Select(a => a.KnownType).ToArray(), jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments, fail); + return Create(info, context, isToJs, function.KnownType, function.ArgsTypeInfo.Select(a => a.KnownType).ToArray(), jsMarshalingInfo.JSType, jsMarshalingInfo.JSTypeArguments); default: - return ResolvedGenerator.NotSupported(info, context, new(info)); + return new(ResolvedGenerator.NotSupported(info, context, new(info)), MarshalerType.None); } } - internal static ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context, bool isToJs, KnownManagedType marshaledType, KnownManagedType[] argumentTypes, JSTypeFlags jsType, JSTypeFlags[] jsTypeArguments, Func failWithReason) + private static ResolvedGeneratorAndType Create(TypePositionInfo info, StubCodeContext context, bool isToJs, KnownManagedType marshaledType, KnownManagedType[] argumentTypes, JSTypeFlags jsType, JSTypeFlags[] jsTypeArguments) { - switch (marshaledType) + return (marshaledType, jsType, argumentTypes, jsTypeArguments) switch { + // void + (KnownManagedType.Void, JSTypeFlags.Void, _, _) => resolved(new Forwarder().Bind(info, context), MarshalerType.Void), + (KnownManagedType.Void, JSTypeFlags.None or JSTypeFlags.Discard, _, _) => resolved(new Forwarder().Bind(info, context), MarshalerType.Discard), + (KnownManagedType.Void, JSTypeFlags.DiscardNoWait, _, _) => resolved(new Forwarder().Bind(info, context), MarshalerType.DiscardNoWait), + + // void missing + (KnownManagedType.Void, JSTypeFlags.Missing, _, _) => resolved(new Forwarder().Bind(info, context), MarshalerType.Discard), + // primitive - case KnownManagedType.Boolean when jsType == JSTypeFlags.Boolean: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Boolean)); - case KnownManagedType.Byte when jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Char when jsType == JSTypeFlags.String: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Char)); - case KnownManagedType.Int16 when jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int16)); - case KnownManagedType.Int32 when jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Int64 when jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int52)); - case KnownManagedType.Int64 when jsType == JSTypeFlags.BigInt: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.BigInt64)); - case KnownManagedType.Single when jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Single)); - case KnownManagedType.Double when jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.IntPtr when jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.IntPtr)); - case KnownManagedType.DateTime when jsType == JSTypeFlags.Date: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.DateTime)); - case KnownManagedType.DateTimeOffset when jsType == JSTypeFlags.Date: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.DateTimeOffset)); - case KnownManagedType.Exception when jsType == JSTypeFlags.Error: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Exception)); - case KnownManagedType.JSObject when jsType == JSTypeFlags.Object: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.JSObject)); - case KnownManagedType.String when jsType == JSTypeFlags.String: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.String)); - case KnownManagedType.Object when jsType == JSTypeFlags.Any: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Object)); + (KnownManagedType.Boolean, JSTypeFlags.Boolean, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Boolean), MarshalerType.Boolean), + (KnownManagedType.Byte, JSTypeFlags.Number, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Byte), MarshalerType.Byte), + (KnownManagedType.Char, JSTypeFlags.String, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Char), MarshalerType.Char), + (KnownManagedType.Int16, JSTypeFlags.Number, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int16), MarshalerType.Int16), + (KnownManagedType.Int32, JSTypeFlags.Number, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int32), MarshalerType.Int32), + (KnownManagedType.Int64, JSTypeFlags.Number, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int52), MarshalerType.Int52), + (KnownManagedType.Int64, JSTypeFlags.BigInt, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.BigInt64), MarshalerType.BigInt64), + (KnownManagedType.Single, JSTypeFlags.Number, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Single), MarshalerType.Single), + (KnownManagedType.Double, JSTypeFlags.Number, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Double), MarshalerType.Double), + (KnownManagedType.IntPtr, JSTypeFlags.Number, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.IntPtr), MarshalerType.IntPtr), + (KnownManagedType.DateTime, JSTypeFlags.Date, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.DateTime), MarshalerType.DateTime), + (KnownManagedType.DateTimeOffset, JSTypeFlags.Date, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.DateTimeOffset), MarshalerType.DateTimeOffset), + (KnownManagedType.Exception, JSTypeFlags.Error, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Exception), MarshalerType.Exception), + (KnownManagedType.JSObject, JSTypeFlags.Object, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.JSObject), MarshalerType.JSObject), + (KnownManagedType.String, JSTypeFlags.String, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.String), MarshalerType.String), + (KnownManagedType.Object, JSTypeFlags.Any, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Object), MarshalerType.Object), // primitive missing - case KnownManagedType.Boolean when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Boolean)); - case KnownManagedType.Byte when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Char when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Char)); - case KnownManagedType.Int16 when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int16)); - case KnownManagedType.Int32 when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Single when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Single)); - case KnownManagedType.Double when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.IntPtr when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.IntPtr)); - case KnownManagedType.Exception when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Exception)); - case KnownManagedType.JSObject when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.JSObject)); - case KnownManagedType.String when jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new PrimitiveJSGenerator(info, context, MarshalerType.String)); + (KnownManagedType.Boolean, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Boolean), MarshalerType.Boolean), + (KnownManagedType.Byte, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Byte), MarshalerType.Byte), + (KnownManagedType.Char, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Char), MarshalerType.Char), + (KnownManagedType.Int16, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int16), MarshalerType.Int16), + (KnownManagedType.Int32, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int32), MarshalerType.Int32), + (KnownManagedType.Single, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Single), MarshalerType.Single), + (KnownManagedType.Double, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Double), MarshalerType.Double), + (KnownManagedType.IntPtr, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.IntPtr), MarshalerType.IntPtr), + (KnownManagedType.Exception, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Exception), MarshalerType.Exception), + (KnownManagedType.JSObject, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.JSObject), MarshalerType.JSObject), + (KnownManagedType.String, JSTypeFlags.Missing, _, _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.String), MarshalerType.String), // primitive forced - case KnownManagedType.Int64 when jsType == JSTypeFlags.Missing: - case KnownManagedType.DateTime when jsType == JSTypeFlags.Missing: - case KnownManagedType.DateTimeOffset when jsType == JSTypeFlags.Missing: - case KnownManagedType.Object when jsType == JSTypeFlags.Missing: - return failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + (KnownManagedType.Int64, JSTypeFlags.Missing, _, _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.DateTime, JSTypeFlags.Missing, _, _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.DateTimeOffset, JSTypeFlags.Missing, _, _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Object, JSTypeFlags.Missing, _, _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), // nullable - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Boolean && jsType == JSTypeFlags.Boolean: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Boolean)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Char && jsType == JSTypeFlags.String: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int16 && jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Int16)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int64 && jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Int52)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int64 && jsType == JSTypeFlags.BigInt: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.BigInt64)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Single && jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Single)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.IntPtr && jsType == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.IntPtr)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.DateTime && jsType == JSTypeFlags.Date: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.DateTime)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.DateTimeOffset && jsType == JSTypeFlags.Date: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.DateTimeOffset)); + (KnownManagedType.Nullable, JSTypeFlags.Boolean, [KnownManagedType.Boolean], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Boolean), MarshalerType.Nullable, [MarshalerType.Boolean]), + (KnownManagedType.Nullable, JSTypeFlags.Number, [KnownManagedType.Byte], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Byte), MarshalerType.Nullable, [MarshalerType.Byte]), + (KnownManagedType.Nullable, JSTypeFlags.String, [KnownManagedType.Char], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Char), MarshalerType.Nullable, [MarshalerType.Char]), + (KnownManagedType.Nullable, JSTypeFlags.Number, [KnownManagedType.Int16], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int16), MarshalerType.Nullable, [MarshalerType.Int16]), + (KnownManagedType.Nullable, JSTypeFlags.Number, [KnownManagedType.Int32], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int32), MarshalerType.Nullable, [MarshalerType.Int32]), + (KnownManagedType.Nullable, JSTypeFlags.Number, [KnownManagedType.Int64], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int52), MarshalerType.Nullable, [MarshalerType.Int52]), + (KnownManagedType.Nullable, JSTypeFlags.BigInt, [KnownManagedType.Int64], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.BigInt64), MarshalerType.Nullable, [MarshalerType.BigInt64]), + (KnownManagedType.Nullable, JSTypeFlags.Number, [KnownManagedType.Single], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Single), MarshalerType.Nullable, [MarshalerType.Single]), + (KnownManagedType.Nullable, JSTypeFlags.Number, [KnownManagedType.Double], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Double), MarshalerType.Nullable, [MarshalerType.Double]), + (KnownManagedType.Nullable, JSTypeFlags.Number, [KnownManagedType.IntPtr], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.IntPtr), MarshalerType.Nullable, [MarshalerType.IntPtr]), + (KnownManagedType.Nullable, JSTypeFlags.Date, [KnownManagedType.DateTime], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.DateTime), MarshalerType.Nullable, [MarshalerType.DateTime]), + (KnownManagedType.Nullable, JSTypeFlags.Date, [KnownManagedType.DateTimeOffset], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.DateTimeOffset), MarshalerType.Nullable, [MarshalerType.DateTimeOffset]), // nullable missing - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Boolean && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Boolean)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Char && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int16 && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Int16)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Single && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Single)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.IntPtr && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new NullableJSGenerator(info, context, MarshalerType.IntPtr)); + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Boolean], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Boolean), MarshalerType.Nullable, [MarshalerType.Boolean]), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Byte], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Byte), MarshalerType.Nullable, [MarshalerType.Byte]), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Char], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Char), MarshalerType.Nullable, [MarshalerType.Char]), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Int16], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int16), MarshalerType.Nullable, [MarshalerType.Int16]), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Int32], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Int32), MarshalerType.Nullable, [MarshalerType.Int32]), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Single], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Single), MarshalerType.Nullable, [MarshalerType.Single]), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Double], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Double), MarshalerType.Nullable, [MarshalerType.Double]), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.IntPtr], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.IntPtr), MarshalerType.Nullable, [MarshalerType.IntPtr]), // nullable forced - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.Int64 && jsType == JSTypeFlags.Missing: - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.DateTime && jsType == JSTypeFlags.Missing: - case KnownManagedType.Nullable when argumentTypes[0] == KnownManagedType.DateTimeOffset && jsType == JSTypeFlags.Missing: - return failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.Int64], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.DateTime], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Nullable, JSTypeFlags.Missing, [KnownManagedType.DateTimeOffset], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + + (KnownManagedType.Nullable, _, _, _) => failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)), - case KnownManagedType.Nullable: - return failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); // task - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes.Length == 0 && jsTypeArguments[0] == JSTypeFlags.Void: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Void)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Byte && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Boolean && jsTypeArguments[0] == JSTypeFlags.Boolean: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Boolean)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Char && jsTypeArguments[0] == JSTypeFlags.String: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Char)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Int16 && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Int16)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Int32 && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Int64 && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Int52)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Int64 && jsTypeArguments[0] == JSTypeFlags.BigInt: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.BigInt64)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.IntPtr && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.IntPtr)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Double && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Single && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Single)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.JSObject && jsTypeArguments[0] == JSTypeFlags.Object: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.JSObject)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.String && jsTypeArguments[0] == JSTypeFlags.String: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.String)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Exception && jsTypeArguments[0] == JSTypeFlags.Error: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Exception)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.DateTime && jsTypeArguments[0] == JSTypeFlags.Date: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.DateTime)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.DateTimeOffset && jsTypeArguments[0] == JSTypeFlags.Date: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.DateTimeOffset)); - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Object && jsTypeArguments[0] == JSTypeFlags.Any: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Object)); + (KnownManagedType.Task, JSTypeFlags.Promise, [], [JSTypeFlags.Void]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Void), MarshalerType.Task, []), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Boolean], [JSTypeFlags.Boolean]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Boolean), MarshalerType.Task, [MarshalerType.Boolean]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Byte], [JSTypeFlags.Number]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Byte), MarshalerType.Task, [MarshalerType.Byte]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Char], [JSTypeFlags.String]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Char), MarshalerType.Task, [MarshalerType.Char]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Int16], [JSTypeFlags.Number]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Int16), MarshalerType.Task, [MarshalerType.Int16]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Int32], [JSTypeFlags.Number]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Int32), MarshalerType.Task, [MarshalerType.Int32]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Int64], [JSTypeFlags.Number]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Int52), MarshalerType.Task, [MarshalerType.Int52]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Int64], [JSTypeFlags.BigInt]) => resolved(new TaskJSGenerator(info, context, MarshalerType.BigInt64), MarshalerType.Task, [MarshalerType.BigInt64]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Single], [JSTypeFlags.Number]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Single), MarshalerType.Task, [MarshalerType.Single]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Double], [JSTypeFlags.Number]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Double), MarshalerType.Task, [MarshalerType.Double]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.IntPtr], [JSTypeFlags.Number]) => resolved(new TaskJSGenerator(info, context, MarshalerType.IntPtr), MarshalerType.Task, [MarshalerType.IntPtr]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.DateTime], [JSTypeFlags.Date]) => resolved(new TaskJSGenerator(info, context, MarshalerType.DateTime), MarshalerType.Task, [MarshalerType.DateTime]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.DateTimeOffset], [JSTypeFlags.Date]) => resolved(new TaskJSGenerator(info, context, MarshalerType.DateTimeOffset), MarshalerType.Task, [MarshalerType.DateTimeOffset]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Exception], [JSTypeFlags.Error]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Exception), MarshalerType.Task, [MarshalerType.Exception]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.JSObject], [JSTypeFlags.Object]) => resolved(new TaskJSGenerator(info, context, MarshalerType.JSObject), MarshalerType.Task, [MarshalerType.JSObject]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.String], [JSTypeFlags.String]) => resolved(new TaskJSGenerator(info, context, MarshalerType.String), MarshalerType.Task, [MarshalerType.String]), + (KnownManagedType.Task, JSTypeFlags.Promise, [KnownManagedType.Object], [JSTypeFlags.Any]) => resolved(new TaskJSGenerator(info, context, MarshalerType.Object), MarshalerType.Task, [MarshalerType.Object]), // task missing - case KnownManagedType.Task when jsType == JSTypeFlags.Missing && argumentTypes.Length == 0: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Void)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Boolean && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Boolean)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Char && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Char)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Int16 && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Int16)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Single && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Single)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.IntPtr && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.IntPtr)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.JSObject && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.JSObject)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.String && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.String)); - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Exception && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new TaskJSGenerator(info, context, MarshalerType.Exception)); + (KnownManagedType.Task, JSTypeFlags.Missing, [], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Void), MarshalerType.Task, []), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Boolean], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Boolean), MarshalerType.Task, [MarshalerType.Boolean]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Byte], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Byte), MarshalerType.Task, [MarshalerType.Byte]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Char], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Char), MarshalerType.Task, [MarshalerType.Char]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Int16], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Int16), MarshalerType.Task, [MarshalerType.Int16]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Int32], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Int32), MarshalerType.Task, [MarshalerType.Int32]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Single], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Single), MarshalerType.Task, [MarshalerType.Single]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Double], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Double), MarshalerType.Task, [MarshalerType.Double]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.IntPtr], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.IntPtr), MarshalerType.Task, [MarshalerType.IntPtr]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Exception], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.Exception), MarshalerType.Task, [MarshalerType.Exception]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.JSObject], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.JSObject), MarshalerType.Task, [MarshalerType.JSObject]), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.String], _) => resolved(new TaskJSGenerator(info, context, MarshalerType.String), MarshalerType.Task, [MarshalerType.String]), // task forced - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Int64 && jsType == JSTypeFlags.Missing: - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.DateTime && jsType == JSTypeFlags.Missing: - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.DateTimeOffset && jsType == JSTypeFlags.Missing: - case KnownManagedType.Task when argumentTypes[0] == KnownManagedType.Object && jsType == JSTypeFlags.Missing: - return failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Int64], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.DateTime], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.DateTimeOffset], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Task, JSTypeFlags.Missing, [KnownManagedType.Object], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), - case KnownManagedType.Task when jsType == JSTypeFlags.Promise && jsTypeArguments.Length == 1: - return failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + (KnownManagedType.Task, JSTypeFlags.Promise, _, [_]) => failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)), // array - case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Byte && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.String && jsTypeArguments[0] == JSTypeFlags.String: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.String)); - case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Double && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Int32 && jsTypeArguments[0] == JSTypeFlags.Number: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.JSObject && jsTypeArguments[0] == JSTypeFlags.Object: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.JSObject)); - case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1 && argumentTypes[0] == KnownManagedType.Object && jsTypeArguments[0] == JSTypeFlags.Any: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.Object)); + (KnownManagedType.Array, JSTypeFlags.Array, [KnownManagedType.Byte], [JSTypeFlags.Number]) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.Byte]), + (KnownManagedType.Array, JSTypeFlags.Array, [KnownManagedType.String], [JSTypeFlags.String]) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.String]), + (KnownManagedType.Array, JSTypeFlags.Array, [KnownManagedType.Double], [JSTypeFlags.Number]) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.Double]), + (KnownManagedType.Array, JSTypeFlags.Array, [KnownManagedType.Int32], [JSTypeFlags.Number]) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.Int32]), + (KnownManagedType.Array, JSTypeFlags.Array, [KnownManagedType.JSObject], [JSTypeFlags.Object]) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.JSObject]), + (KnownManagedType.Array, JSTypeFlags.Array, [KnownManagedType.Object], [JSTypeFlags.Any]) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.Object]), // array missing - case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.String && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.String)); - case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.JSObject && jsType == JSTypeFlags.Missing: return ResolvedGenerator.Resolved(new ArrayJSGenerator(info, context, MarshalerType.JSObject)); - case KnownManagedType.Array when jsType == JSTypeFlags.Array && jsTypeArguments.Length == 1: - return failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + (KnownManagedType.Array, JSTypeFlags.Missing, [KnownManagedType.Byte], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.Byte]), + (KnownManagedType.Array, JSTypeFlags.Missing, [KnownManagedType.String], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.String]), + (KnownManagedType.Array, JSTypeFlags.Missing, [KnownManagedType.Double], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.Double]), + (KnownManagedType.Array, JSTypeFlags.Missing, [KnownManagedType.Int32], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.Int32]), + (KnownManagedType.Array, JSTypeFlags.Missing, [KnownManagedType.JSObject], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Array), MarshalerType.Array, [MarshalerType.JSObject]), + + (KnownManagedType.Array, JSTypeFlags.Array, _, [_]) => failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)), // array forced - case KnownManagedType.Array when argumentTypes[0] == KnownManagedType.Object && jsType == JSTypeFlags.Missing: - return failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + (KnownManagedType.Array, JSTypeFlags.Missing, [KnownManagedType.Object], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), // span view - case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView && jsTypeArguments.Length != 0: - return failWithReason(null); - case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Byte: return ResolvedGenerator.Resolved(new SpanJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Int32: return ResolvedGenerator.Resolved(new SpanJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Double: return ResolvedGenerator.Resolved(new SpanJSGenerator(info, context, MarshalerType.Double)); + (KnownManagedType.Span, JSTypeFlags.MemoryView, _, [_]) => failWithReason(null!), + (KnownManagedType.Span, JSTypeFlags.MemoryView, [KnownManagedType.Byte], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Span), MarshalerType.Span, [MarshalerType.Byte]), + (KnownManagedType.Span, JSTypeFlags.MemoryView, [KnownManagedType.Int32], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Span), MarshalerType.Span, [MarshalerType.Int32]), + (KnownManagedType.Span, JSTypeFlags.MemoryView, [KnownManagedType.Double], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.Span), MarshalerType.Span, [MarshalerType.Double]), - case KnownManagedType.Span when jsType == JSTypeFlags.MemoryView: - return failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + (KnownManagedType.Span, JSTypeFlags.MemoryView, _, _) => failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)), // span forced - case KnownManagedType.Span when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Missing: - case KnownManagedType.Span when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: - case KnownManagedType.Span when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Missing: - return failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + (KnownManagedType.Span, JSTypeFlags.Missing, [KnownManagedType.Byte], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Span, JSTypeFlags.Missing, [KnownManagedType.Int32], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.Span, JSTypeFlags.Missing, [KnownManagedType.Double], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), // segment view - case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView && jsTypeArguments.Length != 0: - return failWithReason(null); - case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Byte: return ResolvedGenerator.Resolved(new ArraySegmentJSGenerator(info, context, MarshalerType.Byte)); - case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Int32: return ResolvedGenerator.Resolved(new ArraySegmentJSGenerator(info, context, MarshalerType.Int32)); - case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView && argumentTypes[0] == KnownManagedType.Double: return ResolvedGenerator.Resolved(new ArraySegmentJSGenerator(info, context, MarshalerType.Double)); - case KnownManagedType.ArraySegment when jsType == JSTypeFlags.MemoryView: - return failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + (KnownManagedType.ArraySegment, JSTypeFlags.MemoryView, _, [_]) => failWithReason(null!), + (KnownManagedType.ArraySegment, JSTypeFlags.MemoryView, [KnownManagedType.Byte], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.ArraySegment), MarshalerType.ArraySegment, [MarshalerType.Byte]), + (KnownManagedType.ArraySegment, JSTypeFlags.MemoryView, [KnownManagedType.Int32], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.ArraySegment), MarshalerType.ArraySegment, [MarshalerType.Int32]), + (KnownManagedType.ArraySegment, JSTypeFlags.MemoryView, [KnownManagedType.Double], _) => resolved(new PrimitiveJSGenerator(info, context, MarshalerType.ArraySegment), MarshalerType.ArraySegment, [MarshalerType.Double]), + + (KnownManagedType.ArraySegment, JSTypeFlags.MemoryView, _, _) => failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)), // segment forced - case KnownManagedType.ArraySegment when argumentTypes[0] == KnownManagedType.Byte && jsType == JSTypeFlags.Missing: - case KnownManagedType.ArraySegment when argumentTypes[0] == KnownManagedType.Int32 && jsType == JSTypeFlags.Missing: - case KnownManagedType.ArraySegment when argumentTypes[0] == KnownManagedType.Double && jsType == JSTypeFlags.Missing: - return failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + (KnownManagedType.ArraySegment, JSTypeFlags.Missing, [KnownManagedType.Byte], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.ArraySegment, JSTypeFlags.Missing, [KnownManagedType.Int32], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + (KnownManagedType.ArraySegment, JSTypeFlags.Missing, [KnownManagedType.Double], _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), // function + action - case KnownManagedType.Function when jsType == JSTypeFlags.Function && jsTypeArguments.Length == argumentTypes.Length: - case KnownManagedType.Action when jsType == JSTypeFlags.Function && jsTypeArguments.Length == argumentTypes.Length: - var argsMarshalers = new List(); - for (int i = 0; i < argumentTypes.Length; i++) - { - var isReturn = marshaledType == KnownManagedType.Function && i == jsTypeArguments.Length - 1; - if (argumentTypes[i] == KnownManagedType.Array - || argumentTypes[i] == KnownManagedType.Span - || argumentTypes[i] == KnownManagedType.ArraySegment - || argumentTypes[i] == KnownManagedType.Task - || argumentTypes[i] == KnownManagedType.Function - || argumentTypes[i] == KnownManagedType.Action - || argumentTypes[i] == KnownManagedType.Unknown - ) - { - return failWithReason(SR.Format(SR.FuncArgumentNotSupported, argumentTypes[i])); - } - var gen = Create(info, context, isToJs ^ (!isReturn), argumentTypes[i], Array.Empty(), jsTypeArguments[i], Array.Empty(), failWithReason); - argsMarshalers.Add(((BaseJSGenerator)gen.Generator).Type); - } - var maxArgs = marshaledType == KnownManagedType.Action ? 3 : 4; - var argsMarshallerTypes = argsMarshalers.ToArray(); - if (argsMarshallerTypes.Length > maxArgs) - { - return failWithReason(SR.FuncTooManyArgs); - } - return ResolvedGenerator.Resolved(new FuncJSGenerator(info, context, marshaledType == KnownManagedType.Action, argsMarshallerTypes)); - case KnownManagedType.Action when jsType == JSTypeFlags.Function: - case KnownManagedType.Function when jsType == JSTypeFlags.Function: - return failWithReason(SR.FuncWrongArgumentCount); + (KnownManagedType.Function or KnownManagedType.Action, JSTypeFlags.Function, var argTypes, var argJSTypes) when argTypes.Length != argJSTypes.Length + => failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)), + + (KnownManagedType.Function or KnownManagedType.Action, JSTypeFlags.Function or JSTypeFlags.Missing, var argTypes, _) when FindFirstInvalidArgType(argTypes) is KnownManagedType invalidArgType + => failWithReason(SR.Format(SR.FuncArgumentNotSupported, invalidArgType)), + + (KnownManagedType.Function or KnownManagedType.Action, JSTypeFlags.Function, var argTypes, var argJSTypes) => ResolveCallback(marshaledType, argTypes, argJSTypes), // function + action forced - case KnownManagedType.Function when jsType == JSTypeFlags.Missing: - case KnownManagedType.Action when jsType == JSTypeFlags.Missing: - for (int i = 0; i < argumentTypes.Length; i++) + (KnownManagedType.Function or KnownManagedType.Action, JSTypeFlags.Missing, _, _) => failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)), + + // void only JSType on non-void + (not KnownManagedType.Void, JSTypeFlags.Discard, _, _) => failWithReason(SR.DiscardOnlyVoid), + (not KnownManagedType.Void, JSTypeFlags.DiscardNoWait, _, _) => failWithReason(SR.DiscardNoWaitOnlyVoid), + + + _ => failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)), + }; + + KnownManagedType? FindFirstInvalidArgType(KnownManagedType[] argumentTypes) + { + foreach (KnownManagedType type in argumentTypes) + { + if (type is KnownManagedType.Array + or KnownManagedType.Span + or KnownManagedType.ArraySegment + or KnownManagedType.Task + or KnownManagedType.Function + or KnownManagedType.Action + or KnownManagedType.Unknown + ) { - if (argumentTypes[i] == KnownManagedType.Array - || argumentTypes[i] == KnownManagedType.Span - || argumentTypes[i] == KnownManagedType.ArraySegment - || argumentTypes[i] == KnownManagedType.Task - || argumentTypes[i] == KnownManagedType.Function - || argumentTypes[i] == KnownManagedType.Action - || argumentTypes[i] == KnownManagedType.Unknown - ) - { - return failWithReason(SR.Format(SR.FuncArgumentNotSupported, argumentTypes[i])); - } + return type; } - return failWithReason(SR.Format(SR.UseJSMarshalAsAttribute, info.ManagedType.FullTypeName)); + } + return null; + } - default: - return failWithReason(SR.Format(SR.TypeNotSupportedName, info.ManagedType.FullTypeName)); + ResolvedGeneratorAndType ResolveCallback(KnownManagedType managedType, KnownManagedType[] argTypes, JSTypeFlags[] argJSTypes) + { + var argsMarshalers = new List(); + for (int i = 0; i < argTypes.Length; i++) + { + var isReturn = managedType == KnownManagedType.Function && i == argJSTypes.Length - 1; + + var gen = Create(info, context, isToJs ^ (!isReturn), argTypes[i], Array.Empty(), argJSTypes[i], Array.Empty()); + argsMarshalers.Add(gen.Type); + } + var maxArgs = managedType == KnownManagedType.Action ? 3 : 4; + MarshalerType[] argsMarshallerTypes = [.. argsMarshalers]; + if (argsMarshallerTypes.Length > maxArgs) + { + return failWithReason(SR.FuncTooManyArgs); + } + return resolved( + new FuncJSGenerator(info, context, managedType == KnownManagedType.Action, argsMarshallerTypes), + managedType == KnownManagedType.Action ? MarshalerType.Action : MarshalerType.Function, + argsMarshallerTypes); + } + + ResolvedGeneratorAndType failWithReason(string failReason) + { + return new( + ResolvedGenerator.NotSupported(info, context, new(info) + { + NotSupportedDetails = failReason + }), + MarshalerType.None); + } + + ResolvedGeneratorAndType resolved(IBoundMarshallingGenerator generator, MarshalerType baseType, IEnumerable? subTypes = null) + { + return new(ResolvedGenerator.Resolved(generator), baseType, subTypes); } } } diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs deleted file mode 100644 index 7891bec53f2186..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Linq; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Microsoft.CodeAnalysis; - -namespace Microsoft.Interop.JavaScript -{ - internal abstract class JSCodeGenerator - { - public const string ReturnIdentifier = "__retVal"; - public const string ReturnNativeIdentifier = $"{ReturnIdentifier}{StubIdentifierContext.GeneratedNativeIdentifierSuffix}"; - public const string InvokeSucceededIdentifier = "__invokeSucceeded"; - } - - internal sealed class JSImportCodeGenerator : JSCodeGenerator - { - private readonly BoundGenerators _marshallers; - - private readonly StubIdentifierContext _context; - private readonly JSImportData _jsImportData; - private readonly JSSignatureContext _signatureContext; - - public JSImportCodeGenerator( - ImmutableArray argTypes, - JSImportData attributeData, - JSSignatureContext signatureContext, - GeneratorDiagnosticsBag diagnosticsBag, - IMarshallingGeneratorResolver generatorResolver) - { - _jsImportData = attributeData; - _signatureContext = signatureContext; - - _marshallers = BoundGenerators.Create(argTypes, generatorResolver, StubCodeContext.DefaultManagedToNativeStub, new EmptyJSGenerator(), out var bindingFailures); - - diagnosticsBag.ReportGeneratorDiagnostics(bindingFailures); - - if (_marshallers.ManagedReturnMarshaller.UsesNativeIdentifier) - { - // If we need a different native return identifier, then recreate the context with the correct identifier before we generate any code. - _context = new DefaultIdentifierContext(ReturnIdentifier, ReturnNativeIdentifier, MarshalDirection.ManagedToUnmanaged) - { - CodeEmitOptions = new(SkipInit: true) - }; - } - else - { - _context = new DefaultIdentifierContext(ReturnIdentifier, ReturnIdentifier, MarshalDirection.ManagedToUnmanaged) - { - CodeEmitOptions = new(SkipInit: true) - }; - } - - // validate task + span mix - if (_marshallers.ManagedReturnMarshaller.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSTaskTypeInfo)) - { - IBoundMarshallingGenerator spanArg = _marshallers.SignatureMarshallers.FirstOrDefault(m => m.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSSpanTypeInfo)); - if (spanArg != default) - { - diagnosticsBag.ReportGeneratorDiagnostic(new GeneratorDiagnostic.NotSupported(spanArg.TypeInfo) - { - NotSupportedDetails = SR.SpanAndTaskNotSupported - }); - } - } - } - - public BlockSyntax GenerateJSImportBody() - { - StatementSyntax invoke = InvokeSyntax(); - GeneratedStatements statements = GeneratedStatements.Create(_marshallers, _context); - bool shouldInitializeVariables = !statements.GuaranteedUnmarshal.IsEmpty || !statements.CleanupCallerAllocated.IsEmpty || !statements.CleanupCalleeAllocated.IsEmpty; - VariableDeclarations declarations = VariableDeclarations.GenerateDeclarationsForManagedToUnmanaged(_marshallers, _context, shouldInitializeVariables); - - var setupStatements = new List(); - BindSyntax(setupStatements); - SetupSyntax(setupStatements); - - if (!(statements.GuaranteedUnmarshal.IsEmpty && statements.CleanupCalleeAllocated.IsEmpty)) - { - setupStatements.Add(SyntaxFactoryExtensions.Declare(PredefinedType(Token(SyntaxKind.BoolKeyword)), InvokeSucceededIdentifier, initializeToDefault: true)); - } - - setupStatements.AddRange(declarations.Initializations); - setupStatements.AddRange(declarations.Variables); - setupStatements.AddRange(statements.Setup); - - var tryStatements = new List(); - tryStatements.AddRange(statements.Marshal); - tryStatements.AddRange(statements.PinnedMarshal); - - tryStatements.Add(invoke); - if (!(statements.GuaranteedUnmarshal.IsEmpty && statements.CleanupCalleeAllocated.IsEmpty)) - { - tryStatements.Add(ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, - IdentifierName(InvokeSucceededIdentifier), - LiteralExpression(SyntaxKind.TrueLiteralExpression)))); - } - - tryStatements.AddRange(statements.NotifyForSuccessfulInvoke); - tryStatements.AddRange(statements.Unmarshal); - - List allStatements = setupStatements; - List finallyStatements = new List(); - if (!(statements.GuaranteedUnmarshal.IsEmpty && statements.CleanupCalleeAllocated.IsEmpty)) - { - finallyStatements.Add(IfStatement(IdentifierName(InvokeSucceededIdentifier), Block(statements.GuaranteedUnmarshal.Concat(statements.CleanupCalleeAllocated)))); - } - - finallyStatements.AddRange(statements.CleanupCallerAllocated); - if (finallyStatements.Count > 0) - { - // Add try-finally block if there are any statements in the finally block - allStatements.Add( - TryStatement(Block(tryStatements), default, FinallyClause(Block(finallyStatements)))); - } - else - { - allStatements.AddRange(tryStatements); - } - - // Return - if (!_marshallers.IsManagedVoidReturn) - allStatements.Add(ReturnStatement(IdentifierName(_context.GetIdentifiers(_marshallers.ManagedReturnMarshaller.TypeInfo).managed))); - - return Block(allStatements); - } - - private void BindSyntax(List statementsToUpdate) - { - var bindingParameters = - (new ArgumentSyntax[] { - Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(_jsImportData.FunctionName))), - Argument( - _jsImportData.ModuleName == null - ? LiteralExpression(SyntaxKind.NullLiteralExpression) - : LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(_jsImportData.ModuleName))), - CreateSignaturesSyntax(), - }); - - statementsToUpdate.Add(IfStatement(BinaryExpression(SyntaxKind.EqualsExpression, IdentifierName(_signatureContext.BindingName), LiteralExpression(SyntaxKind.NullLiteralExpression)), - Block(SingletonList( - ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, - IdentifierName(_signatureContext.BindingName), - InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(Constants.JSFunctionSignatureGlobal), IdentifierName(Constants.BindJSFunctionMethod))) - .WithArgumentList(ArgumentList(SeparatedList(bindingParameters))))))))); - } - - private ArgumentSyntax CreateSignaturesSyntax() - { - IEnumerable types = _marshallers.ManagedReturnMarshaller is IJSMarshallingGenerator jsGen ? jsGen.GenerateBind() : []; - types = types - .Concat(_marshallers.NativeParameterMarshallers.OfType().SelectMany(p => p.GenerateBind())); - - return Argument(ArrayCreationExpression(ArrayType(IdentifierName(Constants.JSMarshalerTypeGlobal)) - .WithRankSpecifiers(SingletonList(ArrayRankSpecifier(SingletonSeparatedList(OmittedArraySizeExpression()))))) - .WithInitializer(InitializerExpression(SyntaxKind.ArrayInitializerExpression, SeparatedList(types)))); - } - - private void SetupSyntax(List statementsToUpdate) - { - statementsToUpdate.Add(LocalDeclarationStatement( - VariableDeclaration(GenericName(Identifier(Constants.SpanGlobal)).WithTypeArgumentList( - TypeArgumentList(SingletonSeparatedList(IdentifierName(Constants.JSMarshalerArgumentGlobal))))) - .WithVariables(SingletonSeparatedList(VariableDeclarator(Identifier(Constants.ArgumentsBuffer)) - .WithInitializer(EqualsValueClause(StackAllocArrayCreationExpression(ArrayType(IdentifierName(Constants.JSMarshalerArgumentGlobal)) - .WithRankSpecifiers(SingletonList(ArrayRankSpecifier(SingletonSeparatedList( - LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(2 + _marshallers.NativeParameterMarshallers.Length))))))))))))); - - statementsToUpdate.Add(LocalDeclarationStatement(VariableDeclaration(RefType(IdentifierName(Constants.JSMarshalerArgumentGlobal))) - .WithVariables(SingletonSeparatedList(VariableDeclarator(Identifier(Constants.ArgumentException)) - .WithInitializer(EqualsValueClause(RefExpression(ElementAccessExpression(IdentifierName(Constants.ArgumentsBuffer)) - .WithArgumentList(BracketedArgumentList(SingletonSeparatedList( - Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0))))))))))))); - - statementsToUpdate.Add(ExpressionStatement( - InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(Constants.ArgumentException), IdentifierName("Initialize"))))); - - statementsToUpdate.Add(LocalDeclarationStatement(VariableDeclaration(RefType(IdentifierName(Constants.JSMarshalerArgumentGlobal))) - .WithVariables(SingletonSeparatedList(VariableDeclarator(Identifier(Constants.ArgumentReturn)) - .WithInitializer(EqualsValueClause(RefExpression(ElementAccessExpression(IdentifierName(Constants.ArgumentsBuffer)) - .WithArgumentList(BracketedArgumentList(SingletonSeparatedList( - Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))))))))))); - - statementsToUpdate.Add(ExpressionStatement( - InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(Constants.ArgumentReturn), IdentifierName("Initialize"))))); - } - - private ExpressionStatementSyntax InvokeSyntax() - { - return ExpressionStatement(InvocationExpression( - MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(Constants.JSFunctionSignatureGlobal), IdentifierName("InvokeJS"))) - .WithArgumentList(ArgumentList(SeparatedList(new[]{ - Argument(IdentifierName(_signatureContext.BindingName)), - Argument(IdentifierName(Constants.ArgumentsBuffer))})))); - } - - public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateTargetMethodSignatureData() - { - return _marshallers.GenerateTargetMethodSignatureData(_context); - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs index c97f6998de9e69..a92ed80b5dd732 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs @@ -2,14 +2,17 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; +using System.Runtime.InteropServices.JavaScript; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +using static Microsoft.Interop.SyntaxFactoryExtensions; [assembly: System.Resources.NeutralResourcesLanguage("en-US")] @@ -198,17 +201,162 @@ private static (MemberDeclarationSyntax, ImmutableArray) Generat { var diagnostics = new GeneratorDiagnosticsBag(new DescriptorProvider(), incrementalContext.DiagnosticLocation, SR.ResourceManager, typeof(FxResources.Microsoft.Interop.JavaScript.JSImportGenerator.SR)); + // We need to add the implicit exception and return arguments to the signature and ensure they are initialized before we start to do any marshalling. + const int NumImplicitArguments = 2; + + ImmutableArray originalElementInfo = incrementalContext.SignatureContext.SignatureContext.ElementTypeInformation; + + ImmutableArray.Builder typeInfoBuilder = ImmutableArray.CreateBuilder(originalElementInfo.Length + NumImplicitArguments); + + TypePositionInfo nativeOnlyParameterTemplate = new TypePositionInfo( + SpecialTypeInfo.Void, + new JSMarshallingInfo( + NoMarshallingInfo.Instance, + new JSInvalidTypeInfo())) + { + ManagedIndex = TypePositionInfo.UnsetIndex, + }; + + typeInfoBuilder.Add( + // Add the exception argument + nativeOnlyParameterTemplate with + { + InstanceIdentifier = Constants.ArgumentException, + NativeIndex = 0, + }); + + typeInfoBuilder.Add( + // Add the incoming return argument + nativeOnlyParameterTemplate with + { + InstanceIdentifier = Constants.ArgumentReturn, + NativeIndex = 1, + }); + + bool hasReturn = false; + + foreach (var info in originalElementInfo) + { + TypePositionInfo updatedInfo = info with + { + MarshallingAttributeInfo = info.MarshallingAttributeInfo is JSMarshallingInfo jsInfo + ? jsInfo.AddElementDependencies([typeInfoBuilder[0], typeInfoBuilder[1]]) + : info.MarshallingAttributeInfo, + }; + + if (info.IsManagedReturnPosition) + { + hasReturn = info.ManagedType != SpecialTypeInfo.Void; + } + + if (info.IsNativeReturnPosition) + { + typeInfoBuilder.Add(updatedInfo); + } + else + { + typeInfoBuilder.Add(updatedInfo with + { + NativeIndex = updatedInfo.NativeIndex + NumImplicitArguments + }); + } + } + + ImmutableArray finalElementInfo = typeInfoBuilder.ToImmutable(); + // Generate stub code - var stubGenerator = new JSImportCodeGenerator( - incrementalContext.SignatureContext.SignatureContext.ElementTypeInformation, + var stubGenerator = new ManagedToNativeStubGenerator( + finalElementInfo, + setLastError: false, + diagnostics, + new CompositeMarshallingGeneratorResolver( + new NoSpanAndTaskMixingResolver(), + new JSGeneratorResolver()), + new CodeEmitOptions(SkipInit: true)); + + const string LocalFunctionName = "__InvokeJSFunction"; + + BlockSyntax code = stubGenerator.GenerateStubBody(LocalFunctionName); + + StatementSyntax bindStatement = GenerateBindSyntax( incrementalContext.JSImportData, incrementalContext.SignatureContext, - diagnostics, - new JSGeneratorResolver()); + SignatureBindingHelpers.CreateSignaturesArgument(incrementalContext.SignatureContext.SignatureContext.ElementTypeInformation, StubCodeContext.DefaultManagedToNativeStub)); - BlockSyntax code = stubGenerator.GenerateJSImportBody(); + LocalFunctionStatementSyntax localFunction = GenerateInvokeFunction(LocalFunctionName, incrementalContext.SignatureContext, stubGenerator, hasReturn); + + return (PrintGeneratedSource(incrementalContext.StubMethodSyntaxTemplate, incrementalContext.SignatureContext, incrementalContext.ContainingSyntaxContext, Block(bindStatement, code, localFunction)), incrementalContext.Diagnostics.Array.AddRange(diagnostics.Diagnostics)); + } + + private static IfStatementSyntax GenerateBindSyntax(JSImportData jsImportData, JSSignatureContext signatureContext, ArgumentSyntax signaturesArgument) + { + var bindingParameters = + (new ArgumentSyntax[] { + Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(jsImportData.FunctionName))), + Argument( + jsImportData.ModuleName == null + ? LiteralExpression(SyntaxKind.NullLiteralExpression) + : LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(jsImportData.ModuleName))), + signaturesArgument, + }); + + return IfStatement(BinaryExpression(SyntaxKind.EqualsExpression, IdentifierName(signatureContext.BindingName), LiteralExpression(SyntaxKind.NullLiteralExpression)), + Block(SingletonList( + ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName(signatureContext.BindingName), + InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, + IdentifierName(Constants.JSFunctionSignatureGlobal), IdentifierName(Constants.BindJSFunctionMethod))) + .WithArgumentList(ArgumentList(SeparatedList(bindingParameters)))))))); + } - return (PrintGeneratedSource(incrementalContext.StubMethodSyntaxTemplate, incrementalContext.SignatureContext, incrementalContext.ContainingSyntaxContext, code), incrementalContext.Diagnostics.Array.AddRange(diagnostics.Diagnostics)); + private static LocalFunctionStatementSyntax GenerateInvokeFunction(string functionName, JSSignatureContext signatureContext, ManagedToNativeStubGenerator stubGenerator, bool hasReturn) + { + var (parameters, returnType, _) = stubGenerator.GenerateTargetMethodSignatureData(); + TypeSyntax jsMarshalerArgument = ParseTypeName(Constants.JSMarshalerArgumentGlobal); + + CollectionExpressionSyntax argumentsBuffer = CollectionExpression( + SeparatedList( + parameters.Parameters + .Select(p => ExpressionElement(IdentifierName(p.Identifier))))); + + List statements = []; + + if (hasReturn) + { + statements.AddRange([ + Declare( + SpanOf(jsMarshalerArgument), + Constants.ArgumentsBuffer, + argumentsBuffer), + MethodInvocationStatement( + IdentifierName(Constants.JSFunctionSignatureGlobal), + IdentifierName("InvokeJS"), + Argument(IdentifierName(signatureContext.BindingName)), + Argument(IdentifierName(Constants.ArgumentsBuffer))), + ReturnStatement( + ElementAccessExpression( + IdentifierName(Constants.ArgumentsBuffer), + BracketedArgumentList(SingletonSeparatedList(Argument( + LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))))) + ]); + } + else + { + statements.Add( + MethodInvocationStatement( + IdentifierName(Constants.JSFunctionSignatureGlobal), + IdentifierName("InvokeJS"), + Argument(IdentifierName(signatureContext.BindingName)), + Argument(argumentsBuffer))); + } + + return LocalFunctionStatement( + hasReturn ? jsMarshalerArgument : PredefinedType(Token(SyntaxKind.VoidKeyword)), + functionName) + .WithBody(Block(statements)) + .WithParameterList(parameters) + .WithAttributeLists(SingletonList(AttributeList(SingletonSeparatedList( + Attribute(IdentifierName(Constants.DebuggerNonUserCodeAttribute)))))); } private static Diagnostic? GetDiagnosticIfInvalidMethodForGeneration(MethodDeclarationSyntax methodSyntax, IMethodSymbol method) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.csproj b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.csproj index d973b24132c6a8..0af96384ebbe8c 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.csproj +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.csproj @@ -27,6 +27,7 @@ + diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSMarshallingInfo.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSMarshallingInfo.cs index edeb7961aadb1e..8d0ed8384486d9 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSMarshallingInfo.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSMarshallingInfo.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.CodeAnalysis; +using System.Collections.Generic; +using System.Collections.Immutable; using System.Runtime.InteropServices.JavaScript; namespace Microsoft.Interop.JavaScript @@ -16,6 +18,14 @@ protected JSMarshallingInfo() public JSTypeFlags JSType { get; init; } public JSTypeFlags[] JSTypeArguments { get; init; } + + private ImmutableArray _elementDependencies = ImmutableArray.Empty; + public override IEnumerable ElementDependencies => _elementDependencies; + + public JSMarshallingInfo AddElementDependencies(IEnumerable elementDependencies) + { + return this with { _elementDependencies = _elementDependencies.AddRange(elementDependencies) }; + } } internal sealed record JSMissingMarshallingInfo : JSMarshallingInfo diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ArrayJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ArrayJSGenerator.cs deleted file mode 100644 index 5d7d55c644bd7f..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ArrayJSGenerator.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices.JavaScript; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Microsoft.Interop.JavaScript -{ - internal sealed class ArrayJSGenerator : PrimitiveJSGenerator - { - private readonly MarshalerType _elementMarshalerType; - - public ArrayJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType elementMarshalerType) - : base(info, context, MarshalerType.Array) - { - _elementMarshalerType = elementMarshalerType; - } - - public override IEnumerable GenerateBind() - { - yield return InvocationExpression(MarshalerTypeName(Type), - ArgumentList(SingletonSeparatedList(Argument(MarshalerTypeName(_elementMarshalerType))))); - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ArraySegmentJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ArraySegmentJSGenerator.cs deleted file mode 100644 index f3785d8bf7e121..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ArraySegmentJSGenerator.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Runtime.InteropServices.JavaScript; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Microsoft.Interop.JavaScript -{ - internal sealed class ArraySegmentJSGenerator : PrimitiveJSGenerator - { - private readonly MarshalerType _elementMarshalerType; - - public ArraySegmentJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType elementMarshalerType) - : base(info, context, MarshalerType.ArraySegment) - { - _elementMarshalerType = elementMarshalerType; - } - - public override IEnumerable GenerateBind() - { - yield return InvocationExpression(MarshalerTypeName(Type), - ArgumentList(SingletonSeparatedList(Argument(MarshalerTypeName(_elementMarshalerType))))); - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/BaseJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/BaseJSGenerator.cs index 1f6eef2346545d..ab1cb7c8de5371 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/BaseJSGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/BaseJSGenerator.cs @@ -7,65 +7,50 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +using static Microsoft.Interop.SyntaxFactoryExtensions; + namespace Microsoft.Interop.JavaScript { - internal abstract class BaseJSGenerator : IJSMarshallingGenerator + internal abstract class BaseJSGenerator(TypePositionInfo info, StubCodeContext codeContext) : IBoundMarshallingGenerator { - protected IBoundMarshallingGenerator _inner; - public MarshalerType Type; - - protected BaseJSGenerator(MarshalerType marshalerType, IBoundMarshallingGenerator inner) - { - _inner = inner; - Type = marshalerType; - } + private static ValueTypeInfo JSMarshalerArgument = new ValueTypeInfo(Constants.JSMarshalerArgumentGlobal, Constants.JSMarshalerArgument, IsByRefLike: false); - public TypePositionInfo TypeInfo => _inner.TypeInfo; + public TypePositionInfo TypeInfo => info; - public StubCodeContext CodeContext => _inner.CodeContext; + public StubCodeContext CodeContext => codeContext; - public ManagedTypeInfo NativeType => _inner.NativeType; + public ManagedTypeInfo NativeType => JSMarshalerArgument; - public SignatureBehavior NativeSignatureBehavior => _inner.NativeSignatureBehavior; + public SignatureBehavior NativeSignatureBehavior => TypeInfo.IsByRef ? SignatureBehavior.PointerToNativeType : SignatureBehavior.NativeType; - public ValueBoundaryBehavior ValueBoundaryBehavior => _inner.ValueBoundaryBehavior; + public ValueBoundaryBehavior ValueBoundaryBehavior => TypeInfo.IsByRef ? ValueBoundaryBehavior.AddressOfNativeIdentifier : ValueBoundaryBehavior.NativeIdentifier; - public virtual bool UsesNativeIdentifier => _inner.UsesNativeIdentifier; + public virtual bool UsesNativeIdentifier => true; public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, out GeneratorDiagnostic? diagnostic) - => _inner.SupportsByValueMarshalKind(marshalKind, out diagnostic); - - public virtual IEnumerable GenerateBind() { - yield return MarshalerTypeName(Type); + diagnostic = null; + return ByValueMarshalKindSupport.NotSupported; } public virtual IEnumerable Generate(StubIdentifierContext context) { - string argName = context.GetAdditionalIdentifier(TypeInfo, "js_arg"); - - if (context.CurrentStage == StubIdentifierContext.Stage.Setup) + MarshalDirection marshalDirection = MarshallerHelpers.GetMarshalDirection(TypeInfo, CodeContext); + if (context.CurrentStage == StubIdentifierContext.Stage.Setup + && marshalDirection == MarshalDirection.ManagedToUnmanaged + && !TypeInfo.IsManagedReturnPosition) { - if (!TypeInfo.IsManagedReturnPosition) - { - yield return LocalDeclarationStatement(VariableDeclaration(RefType(IdentifierName(Constants.JSMarshalerArgumentGlobal))) - .WithVariables(SingletonSeparatedList(VariableDeclarator(Identifier(argName)) - .WithInitializer(EqualsValueClause(RefExpression(ElementAccessExpression(IdentifierName(Constants.ArgumentsBuffer)) - .WithArgumentList(BracketedArgumentList(SingletonSeparatedList( - Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(TypeInfo.ManagedIndex + 2)))))))))))); - } + var (_, js) = context.GetIdentifiers(TypeInfo); + return [ + ExpressionStatement( + MethodInvocation(TypeSyntaxes.System_Runtime_CompilerServices_Unsafe, IdentifierName("SkipInit"), + Argument(IdentifierName(js)) + .WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))) + ]; } - foreach (var x in _inner.Generate(context)) - { - yield return x; - } - } - - protected static IdentifierNameSyntax MarshalerTypeName(MarshalerType marshalerType) - { - return IdentifierName(Constants.JSMarshalerTypeGlobalDot + marshalerType.ToString()); + return []; } protected static IdentifierNameSyntax GetToManagedMethod(MarshalerType marshalerType) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/EmptyJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/EmptyJSGenerator.cs deleted file mode 100644 index e9704fbdc04d2b..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/EmptyJSGenerator.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; -using Microsoft.CodeAnalysis.CSharp.Syntax; - -namespace Microsoft.Interop.JavaScript -{ - internal sealed class EmptyJSGenerator : IUnboundMarshallingGenerator - { - public ManagedTypeInfo AsNativeType(TypePositionInfo info) => info.ManagedType; - public IEnumerable Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext identifierContext) => Array.Empty(); - public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) => SignatureBehavior.ManagedTypeAndAttributes; - public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) => ValueBoundaryBehavior.ManagedIdentifier; - public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) - => ByValueMarshalKindSupportDescriptor.Default.GetSupport(marshalKind, info, out diagnostic); - public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => false; - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/FuncJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/FuncJSGenerator.cs index d4d7f785c55367..f92bc3a4b7691f 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/FuncJSGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/FuncJSGenerator.cs @@ -11,34 +11,16 @@ namespace Microsoft.Interop.JavaScript { - internal sealed class FuncJSGenerator : BaseJSGenerator + internal sealed class FuncJSGenerator(TypePositionInfo info, StubCodeContext context, bool isAction, MarshalerType[] argumentMarshalerTypes) : BaseJSGenerator(info, context) { - private readonly bool _isAction; - private readonly MarshalerType[] _argumentMarshalerTypes; - - public FuncJSGenerator(TypePositionInfo info, StubCodeContext context, bool isAction, MarshalerType[] argumentMarshalerTypes) - : base(isAction ? MarshalerType.Action : MarshalerType.Function, new Forwarder().Bind(info, context)) - { - _isAction = isAction; - _argumentMarshalerTypes = argumentMarshalerTypes; - } - - public override IEnumerable GenerateBind() - { - var args = _argumentMarshalerTypes.Select(x => Argument(MarshalerTypeName(x))).ToList(); - yield return InvocationExpression(MarshalerTypeName(Type), ArgumentList(SeparatedList(args))); - } - public override IEnumerable Generate(StubIdentifierContext context) { - string argName = context.GetAdditionalIdentifier(TypeInfo, "js_arg"); - var target = TypeInfo.IsManagedReturnPosition - ? Constants.ArgumentReturn - : argName; + foreach (var statement in base.Generate(context)) + { + yield return statement; + } - var source = TypeInfo.IsManagedReturnPosition - ? Argument(IdentifierName(context.GetIdentifiers(TypeInfo).native)) - : _inner.AsArgument(context); + var (managed, js) = context.GetIdentifiers(TypeInfo); var jsty = (JSFunctionTypeInfo)((JSMarshallingInfo)TypeInfo.MarshallingAttributeInfo).TypeInfo; var sourceTypes = jsty.ArgsTypeInfo @@ -47,27 +29,22 @@ public override IEnumerable Generate(StubIdentifierContext cont if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition) { - yield return ToManagedMethod(target, source, jsty); + yield return ToManagedMethod(js, Argument(IdentifierName(managed)), jsty); } if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition) { - yield return ToJSMethod(target, source, jsty); - } - - foreach (var x in base.Generate(context)) - { - yield return x; + yield return ToJSMethod(js, Argument(IdentifierName(managed)), jsty); } if (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition) { - yield return ToJSMethod(target, source, jsty); + yield return ToJSMethod(js, Argument(IdentifierName(managed)), jsty); } if (context.CurrentStage == StubIdentifierContext.Stage.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition) { - yield return ToManagedMethod(target, source, jsty); + yield return ToManagedMethod(js, Argument(IdentifierName(managed)), jsty); } } @@ -77,18 +54,18 @@ private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax for (int i = 0; i < info.ArgsTypeInfo.Length; i++) { var sourceType = info.ArgsTypeInfo[i]; - if (!_isAction && i + 1 == info.ArgsTypeInfo.Length) + if (!isAction && i + 1 == info.ArgsTypeInfo.Length) { - arguments.Add(ArgToManaged(i, sourceType.Syntax, _argumentMarshalerTypes[i])); + arguments.Add(ArgToManaged(i, sourceType.Syntax, argumentMarshalerTypes[i])); } else { - arguments.Add(ArgToJS(i, sourceType.Syntax, _argumentMarshalerTypes[i])); + arguments.Add(ArgToJS(i, sourceType.Syntax, argumentMarshalerTypes[i])); } } return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToManagedMethod(Type))) + IdentifierName(target), GetToManagedMethod(isAction ? MarshalerType.Action : MarshalerType.Function))) .WithArgumentList(ArgumentList(SeparatedList(arguments)))); } @@ -98,18 +75,18 @@ private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax sourc for (int i = 0; i < info.ArgsTypeInfo.Length; i++) { var sourceType = info.ArgsTypeInfo[i]; - if (!_isAction && i + 1 == info.ArgsTypeInfo.Length) + if (!isAction && i + 1 == info.ArgsTypeInfo.Length) { - arguments.Add(ArgToJS(i, sourceType.Syntax, _argumentMarshalerTypes[i])); + arguments.Add(ArgToJS(i, sourceType.Syntax, argumentMarshalerTypes[i])); } else { - arguments.Add(ArgToManaged(i, sourceType.Syntax, _argumentMarshalerTypes[i])); + arguments.Add(ArgToManaged(i, sourceType.Syntax, argumentMarshalerTypes[i])); } } return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToJSMethod(Type))) + IdentifierName(target), GetToJSMethod(isAction ? MarshalerType.Action : MarshalerType.Function))) .WithArgumentList(ArgumentList(SeparatedList(arguments)))); } diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/IJSMarshallingGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/IJSMarshallingGenerator.cs deleted file mode 100644 index f60406b21e8695..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/IJSMarshallingGenerator.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using Microsoft.CodeAnalysis.CSharp.Syntax; - -namespace Microsoft.Interop.JavaScript -{ - internal interface IJSMarshallingGenerator : IBoundMarshallingGenerator - { - IEnumerable GenerateBind(); - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ImplicitArgumentGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ImplicitArgumentGenerator.cs new file mode 100644 index 00000000000000..346dfb173f1f8c --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/ImplicitArgumentGenerator.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +using static Microsoft.Interop.SyntaxFactoryExtensions; + + +namespace Microsoft.Interop.JavaScript +{ + internal sealed class ImplicitArgumentGenerator(TypePositionInfo info, StubCodeContext codeContext) : BaseJSGenerator(info, codeContext) + { + public override IEnumerable Generate(StubIdentifierContext context) + { + if (context.CurrentStage == StubIdentifierContext.Stage.Setup) + { + var (_, js) = context.GetIdentifiers(TypeInfo); + return [ + ExpressionStatement( + MethodInvocation(TypeSyntaxes.System_Runtime_CompilerServices_Unsafe, IdentifierName("SkipInit"), + Argument(IdentifierName(js)) + .WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))), + // Unlike the other arguments, we need to initialize the implicit arguments + // as they can set some ambient state necessary for the JSImport logic to function. + ExpressionStatement( + InvocationExpression( + MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, + IdentifierName(js), + IdentifierName("Initialize")), + ArgumentList())) + ]; + } + + return []; + } + } +} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/NullableJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/NullableJSGenerator.cs deleted file mode 100644 index 191c475f1330fa..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/NullableJSGenerator.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Runtime.InteropServices.JavaScript; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Microsoft.Interop.JavaScript -{ - internal sealed class NullableJSGenerator : PrimitiveJSGenerator - { - public NullableJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType resultMarshalerType) - : base(info, context, resultMarshalerType) - { - } - - public override IEnumerable GenerateBind() - { - yield return InvocationExpression(MarshalerTypeName(MarshalerType.Nullable), - ArgumentList(SingletonSeparatedList(Argument(MarshalerTypeName(Type))))); - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/PrimitiveJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/PrimitiveJSGenerator.cs index 5da5c9db179751..ab7830a642ab71 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/PrimitiveJSGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/PrimitiveJSGenerator.cs @@ -9,78 +9,43 @@ namespace Microsoft.Interop.JavaScript { - internal class PrimitiveJSGenerator : BaseJSGenerator + internal sealed class PrimitiveJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType elementMarshallerType) : BaseJSGenerator(info, context) { - public PrimitiveJSGenerator(MarshalerType marshalerType, IBoundMarshallingGenerator inner) - : base(marshalerType, inner) - { - } - - public PrimitiveJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType marshalerType) - : base(marshalerType, new Forwarder().Bind(info, context)) - { - } - // TODO order parameters in such way that affinity capturing parameters are emitted first public override IEnumerable Generate(StubIdentifierContext context) { - string argName = context.GetAdditionalIdentifier(TypeInfo, "js_arg"); - var target = TypeInfo.IsManagedReturnPosition - ? Constants.ArgumentReturn - : argName; - - var source = TypeInfo.IsManagedReturnPosition - ? Argument(IdentifierName(context.GetIdentifiers(TypeInfo).native)) - : _inner.AsArgument(context); - - if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition) + foreach (var statement in base.Generate(context)) { - yield return ToManagedMethod(target, source); + yield return statement; } - if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition) - { - yield return ToJSMethod(target, source); - } + var (managed, js) = context.GetIdentifiers(TypeInfo); - foreach (var x in base.Generate(context)) - { - yield return x; - } + MarshalDirection marshalDirection = MarshallerHelpers.GetMarshalDirection(TypeInfo, CodeContext); - if (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition) + if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && marshalDirection is MarshalDirection.UnmanagedToManaged or MarshalDirection.Bidirectional) { - yield return ToJSMethod(target, source); + yield return ToManagedMethod(js, Argument(IdentifierName(managed))); } - if (context.CurrentStage == StubIdentifierContext.Stage.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition) + if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && marshalDirection is MarshalDirection.ManagedToUnmanaged or MarshalDirection.Bidirectional) { - yield return ToManagedMethod(target, source); + yield return ToJSMethod(js, Argument(IdentifierName(managed))); } } - protected virtual ArgumentSyntax ToManagedMethodRefOrOut(ArgumentSyntax argument) - { - return argument.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)); - } - - protected virtual ArgumentSyntax ToJSMethodRefOrOut(ArgumentSyntax argument) - { - return argument; - } - private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source) { return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToManagedMethod(Type))) - .WithArgumentList(ArgumentList(SingletonSeparatedList(ToManagedMethodRefOrOut(source))))); + IdentifierName(target), GetToManagedMethod(elementMarshallerType))) + .WithArgumentList(ArgumentList(SingletonSeparatedList(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))))); } private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source) { return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToJSMethod(Type))) - .WithArgumentList(ArgumentList(SingletonSeparatedList(ToJSMethodRefOrOut(source))))); + IdentifierName(target), GetToJSMethod(elementMarshallerType))) + .WithArgumentList(ArgumentList(SingletonSeparatedList(source)))); } } } diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/SpanJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/SpanJSGenerator.cs deleted file mode 100644 index afaedf597b6fe5..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/SpanJSGenerator.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Runtime.InteropServices.JavaScript; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Microsoft.Interop.JavaScript -{ - internal sealed class SpanJSGenerator : PrimitiveJSGenerator - { - private readonly MarshalerType _elementMarshalerType; - - public SpanJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType elementMarshalerType) - : base(info, context, MarshalerType.Span) - { - _elementMarshalerType = elementMarshalerType; - } - - public override IEnumerable GenerateBind() - { - yield return InvocationExpression(MarshalerTypeName(Type), - ArgumentList(SingletonSeparatedList(Argument(MarshalerTypeName(_elementMarshalerType))))); - } - } -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/TaskJSGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/TaskJSGenerator.cs index 381f4dac813740..2a05d2a7dff92f 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/TaskJSGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/TaskJSGenerator.cs @@ -9,95 +9,66 @@ namespace Microsoft.Interop.JavaScript { - internal sealed class TaskJSGenerator : BaseJSGenerator + internal sealed class TaskJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType resultMarshalerType) : BaseJSGenerator(info, context) { - private readonly MarshalerType _resultMarshalerType; - - public TaskJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType resultMarshalerType) - : base(MarshalerType.Task, new Forwarder().Bind(info, context)) - { - _resultMarshalerType = resultMarshalerType; - } - - public override IEnumerable GenerateBind() + public override IEnumerable Generate(StubIdentifierContext context) { - var jsty = (JSTaskTypeInfo)((JSMarshallingInfo)TypeInfo.MarshallingAttributeInfo).TypeInfo; - if (jsty.ResultTypeInfo is JSSimpleTypeInfo(KnownManagedType.Void)) - { - yield return InvocationExpression(MarshalerTypeName(MarshalerType.Task), ArgumentList()); - } - else + foreach (var statement in base.Generate(context)) { - yield return InvocationExpression(MarshalerTypeName(MarshalerType.Task), - ArgumentList(SingletonSeparatedList(Argument(MarshalerTypeName(_resultMarshalerType))))); + yield return statement; } - } - public override IEnumerable Generate(StubIdentifierContext context) - { var jsty = (JSTaskTypeInfo)((JSMarshallingInfo)TypeInfo.MarshallingAttributeInfo).TypeInfo; - string argName = context.GetAdditionalIdentifier(TypeInfo, "js_arg"); - var target = TypeInfo.IsManagedReturnPosition - ? Constants.ArgumentReturn - : argName; - - var source = TypeInfo.IsManagedReturnPosition - ? Argument(IdentifierName(context.GetIdentifiers(TypeInfo).native)) - : _inner.AsArgument(context); + var (managed, js) = context.GetIdentifiers(TypeInfo); if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition) { yield return jsty.ResultTypeInfo is JSSimpleTypeInfo(KnownManagedType.Void) - ? ToManagedMethodVoid(target, source) - : ToManagedMethod(target, source, jsty.ResultTypeInfo.Syntax); + ? ToManagedMethodVoid(js, Argument(IdentifierName(managed))) + : ToManagedMethod(js, Argument(IdentifierName(managed)), jsty.ResultTypeInfo.Syntax); } if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition) { yield return jsty.ResultTypeInfo is JSSimpleTypeInfo(KnownManagedType.Void) - ? ToJSMethodVoid(target, source) - : ToJSMethod(target, source, jsty.ResultTypeInfo.Syntax); - } - - foreach (var x in base.Generate(context)) - { - yield return x; + ? ToJSMethodVoid(js, Argument(IdentifierName(managed))) + : ToJSMethod(js, Argument(IdentifierName(managed)), jsty.ResultTypeInfo.Syntax); } if (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition) { yield return jsty.ResultTypeInfo is JSSimpleTypeInfo(KnownManagedType.Void) - ? ToJSMethodVoid(target, source) - : ToJSMethod(target, source, jsty.ResultTypeInfo.Syntax); + ? ToJSMethodVoid(js, Argument(IdentifierName(managed))) + : ToJSMethod(js, Argument(IdentifierName(managed)), jsty.ResultTypeInfo.Syntax); } if (context.CurrentStage == StubIdentifierContext.Stage.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition) { yield return jsty.ResultTypeInfo is JSSimpleTypeInfo(KnownManagedType.Void) - ? ToManagedMethodVoid(target, source) - : ToManagedMethod(target, source, jsty.ResultTypeInfo.Syntax); + ? ToManagedMethodVoid(js, Argument(IdentifierName(managed))) + : ToManagedMethod(js, Argument(IdentifierName(managed)), jsty.ResultTypeInfo.Syntax); } } - private ExpressionStatementSyntax ToManagedMethodVoid(string target, ArgumentSyntax source) + private static ExpressionStatementSyntax ToManagedMethodVoid(string target, ArgumentSyntax source) { return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToManagedMethod(Type))) + IdentifierName(target), GetToManagedMethod(MarshalerType.Task))) .WithArgumentList(ArgumentList(SingletonSeparatedList(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))))); } - private ExpressionStatementSyntax ToJSMethodVoid(string target, ArgumentSyntax source) + private static ExpressionStatementSyntax ToJSMethodVoid(string target, ArgumentSyntax source) { return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToJSMethod(Type))) + IdentifierName(target), GetToJSMethod(MarshalerType.Task))) .WithArgumentList(ArgumentList(SingletonSeparatedList(source)))); } private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, TypeSyntax sourceType) { return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToManagedMethod(Type))) + IdentifierName(target), GetToManagedMethod(MarshalerType.Task))) .WithArgumentList(ArgumentList(SeparatedList(new[]{ source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)), Argument(ParenthesizedLambdaExpression() @@ -111,7 +82,7 @@ private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax .WithType(sourceType)}))) .WithBlock(Block(SingletonList(ExpressionStatement( InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName("__task_result_arg"), GetToManagedMethod(_resultMarshalerType))) + IdentifierName("__task_result_arg"), GetToManagedMethod(resultMarshalerType))) .WithArgumentList(ArgumentList(SeparatedList(new[]{ Argument(IdentifierName("__task_result")).WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)), }))))))))})))); @@ -120,7 +91,7 @@ private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, TypeSyntax sourceType) { return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(target), GetToJSMethod(Type))) + IdentifierName(target), GetToJSMethod(MarshalerType.Task))) .WithArgumentList(ArgumentList(SeparatedList(new[]{ source, Argument(ParenthesizedLambdaExpression() @@ -133,7 +104,7 @@ private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax sourc .WithType(sourceType)}))) .WithBlock(Block(SingletonList(ExpressionStatement( InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, - IdentifierName("__task_result_arg"), GetToJSMethod(_resultMarshalerType))) + IdentifierName("__task_result_arg"), GetToJSMethod(resultMarshalerType))) .WithArgumentList(ArgumentList(SeparatedList(new[]{ Argument(IdentifierName("__task_result")), }))))))))})))); diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/VoidGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/VoidGenerator.cs deleted file mode 100644 index 2177f5436e431e..00000000000000 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/VoidGenerator.cs +++ /dev/null @@ -1,9 +0,0 @@ -// 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.JavaScript; - -namespace Microsoft.Interop.JavaScript -{ - internal sealed class VoidGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType marshalerType) : BaseJSGenerator(marshalerType, new Forwarder().Bind(info, context)); -} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/NoSpanAndTaskMixingResolver.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/NoSpanAndTaskMixingResolver.cs new file mode 100644 index 00000000000000..1d46d530a958ea --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/NoSpanAndTaskMixingResolver.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Interop.JavaScript +{ + internal sealed class NoSpanAndTaskMixingResolver : IMarshallingGeneratorResolver + { + private bool _hasSpan; + private bool _hasTask; + + public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) + { + bool foundInteresting = false; + if (info.MarshallingAttributeInfo is JSMarshallingInfo(_, JSSpanTypeInfo)) + { + _hasSpan = true; + foundInteresting = true; + } + + if (info.MarshallingAttributeInfo is JSMarshallingInfo(_, JSTaskTypeInfo) && info.IsManagedReturnPosition) + { + _hasTask = true; + foundInteresting = true; + } + + if (foundInteresting && _hasSpan && _hasTask) + { + return ResolvedGenerator.NotSupported(info, context, + new GeneratorDiagnostic.NotSupported(info) + { + NotSupportedDetails = SR.SpanAndTaskNotSupported + }); + } + + return ResolvedGenerator.UnresolvedGenerator; + } + } +} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/SignatureBindingHelpers.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/SignatureBindingHelpers.cs new file mode 100644 index 00000000000000..d8a3a8231904fc --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/SignatureBindingHelpers.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Runtime.InteropServices.JavaScript; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; + +namespace Microsoft.Interop.JavaScript +{ + internal static class SignatureBindingHelpers + { + public static ArgumentSyntax CreateSignaturesArgument(ImmutableArray elements, StubCodeContext context) + { + List arguments = []; + + foreach (TypePositionInfo element in elements.Where(e => e.NativeIndex != TypePositionInfo.UnsetIndex).OrderBy(e => e.NativeIndex)) + { + var (baseType, subTypes) = JSGeneratorResolver.GetMarshallerTypeForBinding(element, context); + ExpressionSyntax bindSyntax = MarshalerTypeName(baseType); + if (subTypes is not null) + { + bindSyntax = InvocationExpression(bindSyntax, + ArgumentList(SeparatedList(subTypes.Select(s => Argument(MarshalerTypeName(s)))))); + } + arguments.Add(ExpressionElement(bindSyntax)); + } + + return Argument(CollectionExpression(SeparatedList(arguments))); + } + + private static IdentifierNameSyntax MarshalerTypeName(MarshalerType marshalerType) + { + return IdentifierName(Constants.JSMarshalerTypeGlobalDot + marshalerType.ToString()); + } + + } +} diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSFunctionBinding.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSFunctionBinding.cs index f6be095eecab92..7f1447673f85e6 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSFunctionBinding.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSFunctionBinding.cs @@ -261,19 +261,22 @@ internal static unsafe void DispatchJSFunctionSync(JSObject jsFunction, Span arguments) { - var args = (nint)Unsafe.AsPointer(ref arguments[0]); - var sig = (nint)signature.Header; + fixed (JSMarshalerArgument* argsPtr = arguments) + { + var args = (nint)argsPtr; + var sig = (nint)signature.Header; - ref JSMarshalerArgument exc = ref arguments[0]; + ref JSMarshalerArgument exc = ref arguments[0]; - // we already know that we are not on the right thread - // this will be blocking until resolved by that thread - Interop.Runtime.InvokeJSImportSyncSend(targetContext.JSNativeTID, sig, args); + // we already know that we are not on the right thread + // this will be blocking until resolved by that thread + Interop.Runtime.InvokeJSImportSyncSend(targetContext.JSNativeTID, sig, args); - if (exc.slot.Type != MarshalerType.None) - { - JSHostImplementation.ThrowException(ref exc); + if (exc.slot.Type != MarshalerType.None) + { + JSHostImplementation.ThrowException(ref exc); + } } } @@ -412,8 +418,7 @@ internal static unsafe void DispatchJSImportAsyncPost(JSFunctionBinding signatur var bytes = sizeof(JSMarshalerArgument) * arguments.Length; void* cpy = (void*)Marshal.AllocHGlobal(bytes); - void* src = Unsafe.AsPointer(ref arguments[0]); - Unsafe.CopyBlock(cpy, src, (uint)bytes); + arguments.CopyTo(new Span(cpy, arguments.Length)); var sig = (nint)signature.Header; // we already know that we are not on the right thread @@ -476,8 +481,7 @@ internal static unsafe void ResolveOrRejectPromise(JSProxyContext targetContext, // this copy is freed in mono_wasm_resolve_or_reject_promise var bytes = sizeof(JSMarshalerArgument) * arguments.Length; void* cpy = (void*)Marshal.AllocHGlobal(bytes); - void* src = Unsafe.AsPointer(ref arguments[0]); - Unsafe.CopyBlock(cpy, src, (uint)bytes); + arguments.CopyTo(new Span(cpy, arguments.Length)); // async Interop.Runtime.ResolveOrRejectPromisePost(targetContext.JSNativeTID, (nint)cpy); diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/Compiles.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/Compiles.cs index 466cd3072f1ef4..b376bb096b6fb1 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/Compiles.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/Compiles.cs @@ -51,7 +51,7 @@ public void ValidateSnippets(string source) } [Fact] - public async Task ValidateGeneratedSourceOutput() + public async Task ValidateGeneratedSourceOutput_AllAnnotatedParameters() { var test = new Test() { @@ -71,70 +71,97 @@ internal static partial void Annotated(object a1, long a2, long a3, global::Syst { if (__signature_Annotated_1583225186 == null) { - __signature_Annotated_1583225186 = global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindJSFunction("DoesNotExist", null, new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Discard, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Action(), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Function(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Span(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.ArraySegment(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Array(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64) }); + __signature_Annotated_1583225186 = global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindJSFunction("DoesNotExist", null, [global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Discard, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Action(), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Function(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Span(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.ArraySegment(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Array(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64)]); } - global::System.Span __arguments_buffer = stackalloc global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument[17]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __arg_exception = ref __arguments_buffer[0]; - __arg_exception.Initialize(); - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __arg_return = ref __arguments_buffer[1]; - __arg_return.Initialize(); - // Setup - Perform required setup. - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a15_native__js_arg = ref __arguments_buffer[16]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a14_native__js_arg = ref __arguments_buffer[15]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a13_native__js_arg = ref __arguments_buffer[14]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a12_native__js_arg = ref __arguments_buffer[13]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a11_native__js_arg = ref __arguments_buffer[12]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a10_native__js_arg = ref __arguments_buffer[11]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a9_native__js_arg = ref __arguments_buffer[10]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a8_native__js_arg = ref __arguments_buffer[9]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a7_native__js_arg = ref __arguments_buffer[8]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a6_native__js_arg = ref __arguments_buffer[7]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a5_native__js_arg = ref __arguments_buffer[6]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a4_native__js_arg = ref __arguments_buffer[5]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a3_native__js_arg = ref __arguments_buffer[4]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a2_native__js_arg = ref __arguments_buffer[3]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a1_native__js_arg = ref __arguments_buffer[2]; - // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. - __a15_native__js_arg.ToJS(a15, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, long __task_result) => { - __task_result_arg.ToJSBig(__task_result); - }); - __a14_native__js_arg.ToJS(a14, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, long __task_result) => - { - __task_result_arg.ToJS(__task_result); - }); - __a13_native__js_arg.ToJS(a13, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, global::System.DateTimeOffset __task_result) => - { - __task_result_arg.ToJS(__task_result); - }); - __a12_native__js_arg.ToJS(a12, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, global::System.DateTime __task_result) => - { - __task_result_arg.ToJS(__task_result); - }); - __a11_native__js_arg.ToJS(a11); - __a10_native__js_arg.ToJS(a10); - __a9_native__js_arg.ToJS(a9); - __a8_native__js_arg.ToJS(a8, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, object __task_result) => - { - __task_result_arg.ToJS(__task_result); - }); - __a7_native__js_arg.ToJS(a7); - __a6_native__js_arg.ToJS(a6); - __a5_native__js_arg.ToJS(a5, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __delegate_arg_arg1, int __delegate_arg1) => + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_exception_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_return_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a1_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a2_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a3_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a4_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a5_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a6_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a7_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a8_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a9_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a10_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a11_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a12_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a13_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a14_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a15_native; + // Setup - Perform required setup. + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out ____arg_return_native); + ____arg_return_native.Initialize(); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out ____arg_exception_native); + ____arg_exception_native.Initialize(); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a15_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a14_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a13_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a12_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a11_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a10_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a9_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a8_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a7_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a6_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a5_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a4_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a3_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a2_native); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out __a1_native); + // Marshal - Convert managed data to native data. + __a11_native.ToJS(a11); + __a10_native.ToJS(a10); + __a9_native.ToJS(a9); + __a7_native.ToJS(a7); + __a6_native.ToJS(a6); + __a3_native.ToJSBig(a3); + __a2_native.ToJS(a2); + __a1_native.ToJS(a1); + { + // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. + __a15_native.ToJS(a15, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, long __task_result) => + { + __task_result_arg.ToJSBig(__task_result); + }); + __a14_native.ToJS(a14, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, long __task_result) => + { + __task_result_arg.ToJS(__task_result); + }); + __a13_native.ToJS(a13, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, global::System.DateTimeOffset __task_result) => + { + __task_result_arg.ToJS(__task_result); + }); + __a12_native.ToJS(a12, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, global::System.DateTime __task_result) => + { + __task_result_arg.ToJS(__task_result); + }); + __a8_native.ToJS(a8, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, object __task_result) => + { + __task_result_arg.ToJS(__task_result); + }); + __a5_native.ToJS(a5, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __delegate_arg_arg1, int __delegate_arg1) => + { + __delegate_arg_arg1.ToJS(__delegate_arg1); + }); + __a4_native.ToJS(a4); + __InvokeJSFunction(____arg_exception_native, ____arg_return_native, __a1_native, __a2_native, __a3_native, __a4_native, __a5_native, __a6_native, __a7_native, __a8_native, __a9_native, __a10_native, __a11_native, __a12_native, __a13_native, __a14_native, __a15_native); + } + } + + [global::System.Diagnostics.DebuggerNonUserCode] + void __InvokeJSFunction(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_exception_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_return_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a1_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a2_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a3_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a4_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a5_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a6_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a7_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a8_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a9_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a10_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a11_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a12_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a13_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a14_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a15_native) { - __delegate_arg_arg1.ToJS(__delegate_arg1); - }); - __a4_native__js_arg.ToJS(a4); - __a3_native__js_arg.ToJSBig(a3); - __a2_native__js_arg.ToJS(a2); - __a1_native__js_arg.ToJS(a1); - global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.InvokeJS(__signature_Annotated_1583225186, __arguments_buffer); + global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.InvokeJS(__signature_Annotated_1583225186, [____arg_exception_native, ____arg_return_native, __a1_native, __a2_native, __a3_native, __a4_native, __a5_native, __a6_native, __a7_native, __a8_native, __a9_native, __a10_native, __a11_native, __a12_native, __a13_native, __a14_native, __a15_native]); + } } static global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding __signature_Annotated_1583225186; } - + """.ReplaceLineEndings("\r\n"), Encoding.UTF8)), (typeof(Microsoft.Interop.JavaScript.JSExportGenerator), "JSExports.g.cs", @@ -158,7 +185,7 @@ static void __Register_() if (initialized || global::System.Runtime.InteropServices.RuntimeInformation.OSArchitecture != global::System.Runtime.InteropServices.Architecture.Wasm) return; initialized = true; - global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[TestProject]Basic:AnnotatedExport", 1583225186, new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Discard, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Action(), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Function(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Span(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.ArraySegment(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Array(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64) }); + global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[TestProject]Basic:AnnotatedExport", 1583225186, [global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Discard, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Action(), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Function(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Span(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.ArraySegment(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Array(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64)]); } } } @@ -167,84 +194,195 @@ unsafe partial class Basic [global::System.Diagnostics.DebuggerNonUserCode] internal static unsafe void __Wrapper_AnnotatedExport_1583225186(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument* __arguments_buffer) { - object a1; - long a2; - long a3; - global::System.Action a4; - global::System.Func a5; - global::System.Span a6; - global::System.ArraySegment a7; - global::System.Threading.Tasks.Task a8; - object[] a9; - global::System.DateTime a10; - global::System.DateTimeOffset a11; - global::System.Threading.Tasks.Task a12; - global::System.Threading.Tasks.Task a13; - global::System.Threading.Tasks.Task a14; - global::System.Threading.Tasks.Task a15; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __arg_exception = ref __arguments_buffer[0]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __arg_return = ref __arguments_buffer[1]; - // Setup - Perform required setup. - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a15_native__js_arg = ref __arguments_buffer[16]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a14_native__js_arg = ref __arguments_buffer[15]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a13_native__js_arg = ref __arguments_buffer[14]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a12_native__js_arg = ref __arguments_buffer[13]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a11_native__js_arg = ref __arguments_buffer[12]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a10_native__js_arg = ref __arguments_buffer[11]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a9_native__js_arg = ref __arguments_buffer[10]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a8_native__js_arg = ref __arguments_buffer[9]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a7_native__js_arg = ref __arguments_buffer[8]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a6_native__js_arg = ref __arguments_buffer[7]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a5_native__js_arg = ref __arguments_buffer[6]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a4_native__js_arg = ref __arguments_buffer[5]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a3_native__js_arg = ref __arguments_buffer[4]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a2_native__js_arg = ref __arguments_buffer[3]; - ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a1_native__js_arg = ref __arguments_buffer[2]; - try + __Stub(__arguments_buffer[2], __arguments_buffer[3], __arguments_buffer[4], __arguments_buffer[5], __arguments_buffer[6], __arguments_buffer[7], __arguments_buffer[8], __arguments_buffer[9], __arguments_buffer[10], __arguments_buffer[11], __arguments_buffer[12], __arguments_buffer[13], __arguments_buffer[14], __arguments_buffer[15], __arguments_buffer[16], __arguments_buffer); + [global::System.Diagnostics.DebuggerNonUserCode] + void __Stub(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a1_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a2_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a3_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a4_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a5_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a6_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a7_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a8_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a9_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a10_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a11_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a12_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a13_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a14_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __a15_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument* ____arg_exception_native__param) { - // Unmarshal - Convert native data to managed data. - __a15_native__js_arg.ToManaged(out a15, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out long __task_result) => + object a1 = default; + long a2 = default; + long a3 = default; + global::System.Action a4 = default; + global::System.Func a5 = default; + global::System.Span a6 = default; + global::System.ArraySegment a7 = default; + global::System.Threading.Tasks.Task a8 = default; + object[] a9 = default; + global::System.DateTime a10 = default; + global::System.DateTimeOffset a11 = default; + global::System.Threading.Tasks.Task a12 = default; + global::System.Threading.Tasks.Task a13 = default; + global::System.Threading.Tasks.Task a14 = default; + global::System.Threading.Tasks.Task a15 = default; + ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_exception_native = ref *____arg_exception_native__param; + try { - __task_result_arg.ToManagedBig(out __task_result); - }); - __a14_native__js_arg.ToManaged(out a14, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out long __task_result) => + // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. + __a11_native.ToManaged(out a11); + __a10_native.ToManaged(out a10); + __a9_native.ToManaged(out a9); + __a7_native.ToManaged(out a7); + __a6_native.ToManaged(out a6); + __a3_native.ToManagedBig(out a3); + __a2_native.ToManaged(out a2); + __a1_native.ToManaged(out a1); + // Unmarshal - Convert native data to managed data. + __a15_native.ToManaged(out a15, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out long __task_result) => + { + __task_result_arg.ToManagedBig(out __task_result); + }); + __a14_native.ToManaged(out a14, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out long __task_result) => + { + __task_result_arg.ToManaged(out __task_result); + }); + __a13_native.ToManaged(out a13, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out global::System.DateTimeOffset __task_result) => + { + __task_result_arg.ToManaged(out __task_result); + }); + __a12_native.ToManaged(out a12, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out global::System.DateTime __task_result) => + { + __task_result_arg.ToManaged(out __task_result); + }); + __a8_native.ToManaged(out a8, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out object __task_result) => + { + __task_result_arg.ToManaged(out __task_result); + }); + __a5_native.ToManaged(out a5, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __delegate_arg_arg1, out int __delegate_arg1) => + { + __delegate_arg_arg1.ToManaged(out __delegate_arg1); + }); + __a4_native.ToManaged(out a4); + Basic.AnnotatedExport(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + catch (global::System.Exception __arg_exception) { - __task_result_arg.ToManaged(out __task_result); - }); - __a13_native__js_arg.ToManaged(out a13, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out global::System.DateTimeOffset __task_result) => - { - __task_result_arg.ToManaged(out __task_result); - }); - __a12_native__js_arg.ToManaged(out a12, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out global::System.DateTime __task_result) => + ____arg_exception_native.ToJS(__arg_exception); + } + } + } + } + + """.ReplaceLineEndings("\r\n"), Encoding.UTF8)), + } + }, + }; + + await test.RunAsync(); + } + + [Fact] + public async Task ValidateGeneratedSourceOutput_Return() + { + var test = new Test() + { + TestState = + { + Sources = { CodeSnippets.DefaultReturnMarshaler("System.Threading.Tasks.Task") }, + GeneratedSources = + { + (typeof(Microsoft.Interop.JavaScript.JSImportGenerator), + "JSImports.g.cs", + SourceText.From(""" + // + unsafe partial class Basic + { + [global::System.Diagnostics.DebuggerNonUserCode] + public static partial global::System.Threading.Tasks.Task Import1() + { + if (__signature_Import1_622134597 == null) + { + __signature_Import1_622134597 = global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindJSFunction("DoesNotExist", null, [global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32)]); + } + + { + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_exception_native; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_return_native; + global::System.Threading.Tasks.Task __retVal; + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __retVal_native; + // Setup - Perform required setup. + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out ____arg_return_native); + ____arg_return_native.Initialize(); + global::System.Runtime.CompilerServices.Unsafe.SkipInit(out ____arg_exception_native); + ____arg_exception_native.Initialize(); { - __task_result_arg.ToManaged(out __task_result); - }); - __a11_native__js_arg.ToManaged(out a11); - __a10_native__js_arg.ToManaged(out a10); - __a9_native__js_arg.ToManaged(out a9); - __a8_native__js_arg.ToManaged(out a8, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out object __task_result) => + __retVal_native = __InvokeJSFunction(____arg_exception_native, ____arg_return_native); + } + + // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. + __retVal_native.ToManaged(out __retVal, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, out int __task_result) => { __task_result_arg.ToManaged(out __task_result); }); - __a7_native__js_arg.ToManaged(out a7); - __a6_native__js_arg.ToManaged(out a6); - __a5_native__js_arg.ToManaged(out a5, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __delegate_arg_arg1, out int __delegate_arg1) => - { - __delegate_arg_arg1.ToManaged(out __delegate_arg1); - }); - __a4_native__js_arg.ToManaged(out a4); - __a3_native__js_arg.ToManagedBig(out a3); - __a2_native__js_arg.ToManaged(out a2); - __a1_native__js_arg.ToManaged(out a1); - Basic.AnnotatedExport(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + return __retVal; } - catch (global::System.Exception ex) + + [global::System.Diagnostics.DebuggerNonUserCode] + global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __InvokeJSFunction(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_exception_native, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_return_native) { - __arg_exception.ToJS(ex); + global::System.Span __arguments_buffer = [____arg_exception_native, ____arg_return_native]; + global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.InvokeJS(__signature_Import1_622134597, __arguments_buffer); + return __arguments_buffer[1]; } } + + static global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding __signature_Import1_622134597; } - + + """.ReplaceLineEndings("\r\n"), Encoding.UTF8)), + (typeof(Microsoft.Interop.JavaScript.JSExportGenerator), + "JSExports.g.cs", + SourceText.From(""" + // + namespace System.Runtime.InteropServices.JavaScript + { + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute] + unsafe class __GeneratedInitializer + { + [global::System.ThreadStaticAttribute] + static bool initialized; + [global::System.Runtime.CompilerServices.ModuleInitializerAttribute, global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods, "System.Runtime.InteropServices.JavaScript.__GeneratedInitializer", "TestProject")] + static internal void __TrimmingPreserve_() + { + } + + [global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute("__Wrapper_Export1_622134597", "Basic", "TestProject")] + static void __Register_() + { + if (initialized || global::System.Runtime.InteropServices.RuntimeInformation.OSArchitecture != global::System.Runtime.InteropServices.Architecture.Wasm) + return; + initialized = true; + global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[TestProject]Basic:Export1", 622134597, [global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32)]); + } + } + } + unsafe partial class Basic + { + [global::System.Diagnostics.DebuggerNonUserCode] + internal static unsafe void __Wrapper_Export1_622134597(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument* __arguments_buffer) + { + __Stub(__arguments_buffer, __arguments_buffer + 1); + [global::System.Diagnostics.DebuggerNonUserCode] + void __Stub(global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument* ____arg_exception_native__param, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument* __invokeRetValUnmanaged__param) + { + ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument ____arg_exception_native = ref *____arg_exception_native__param; + ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __invokeRetValUnmanaged = ref *__invokeRetValUnmanaged__param; + global::System.Threading.Tasks.Task __invokeRetVal = default; + try + { + __invokeRetVal = Basic.Export1(); + // Marshal - Convert managed data to native data. + __invokeRetValUnmanaged.ToJS(__invokeRetVal, static (ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument __task_result_arg, int __task_result) => + { + __task_result_arg.ToJS(__task_result); + }); + } + catch (global::System.Exception __arg_exception) + { + ____arg_exception_native.ToJS(__arg_exception); + } + } + } + } + """.ReplaceLineEndings("\r\n"), Encoding.UTF8)), } }, diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs index c247ef332921f3..278270b470b871 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs @@ -490,6 +490,7 @@ await executor.Execute(async () => } [Theory, MemberData(nameof(GetTargetThreadsAndBlockingCalls))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/99951")] public async Task WaitInAsyncAssertsOnlyOnJSWebWorker(Executor executor, NamedCall method) { using var cts = CreateTestCaseTimeoutSource(); diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx index 55fbc3b4247ede..7253540e16a0df 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx @@ -180,8 +180,8 @@ The marshaller entry point type '{0}' for managed type '{1}' must have an arity of one greater than the managed type. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. Containing type '{0}' has accessibility '{1}'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf index 08e92ac26a5c47..28fedf962b6b43 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf @@ -842,9 +842,9 @@ Typ vstupního bodu řadiče „{0}“ pro spravovaný typ „{1}“ musí mít aritu o jednu větší než spravovaný typ. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Všechny zařazovací moduly pro hodnoty, které jsou předány jako nespravovaná návratová hodnota, musí mít stejný nespravovaný typ. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf index 787fa64fdcc10d..d6e696e7869ecf 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf @@ -842,9 +842,9 @@ Der Marshaller-Einstiegspunkttyp "{0}" für den verwalteten Typ "{1}" muss eine Stelligkeit aufweisen, die größer als der verwaltete Typ ist. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Alle Marshaller für Werte, die als nicht verwalteter Rückgabewert übergeben werden, müssen denselben nicht verwalteten Typ aufweisen. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf index 40fe7056997fcc..047562a0f5d5f7 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf @@ -842,9 +842,9 @@ El tipo de punto de entrada del serializador "{0}" para el tipo administrado "{1}" debe tener una aridad mayor que el tipo administrado. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Todos los serializadores para los valores que se pasan como valor devuelto no administrado deberán tener el mismo tipo no administrado. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf index 8fdb9e66b2f816..bfef83e646d4c4 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf @@ -842,9 +842,9 @@ Le type de point d’entrée marshaleur '{0}' pour le type managé '{1}' doit avoir une arité supérieure au type managé. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Tous les marshaleurs pour les valeurs passées en tant que valeur de retour non managée doivent avoir le même type non managé. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf index 2a5f152ed18c65..e69220e9490ac6 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf @@ -842,9 +842,9 @@ Il tipo di punto di ingresso del marshalling '{0}' per il tipo gestito '{1}' deve avere un grado maggiore rispetto a quello del tipo gestito. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Tutti i marshalling per i valori passati come valore restituito non gestito devono avere lo stesso tipo non gestito. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf index 999325fdc4e6b4..78a71157862438 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf @@ -842,9 +842,9 @@ マネージド型 '{1}' のマーシャラー エントリ ポイント型 '{0}' には、マネージド型より 1 大きい引数が必要です。 - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - アンマネージ戻り値として渡される値のすべてのマーシャラーは、同じアンマネージ型を持つ必要があります。 + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf index 10f9cf84afe3ab..7ba79359c4e9bb 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf @@ -842,9 +842,9 @@ 관리 유형 '{1}'에 대한 마샬러 진입점 유형 '{0}'에는 관리 유형보다 1이 더 커야 합니다. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - 관리되지 않는 반환 값으로 전달되는 값에 대한 모든 마샬러는 관리되지 않는 형식이 동일해야 합니다. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf index 55c27cde0e5387..b3201d69110f3e 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf @@ -842,9 +842,9 @@ Typ punktu wejścia marshallera „{0}” dla typu zarządzanego „{1}” musi mieć liczbę argumentów o jeden większą niż typ zarządzany. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Wszystkie elementy organizujące dla wartości przekazywanych jako niezarządzana wartość zwracana muszą mieć ten sam typ niezarządzany. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. @@ -1321,4 +1321,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf index 9446ca11ff9b27..6ff06e10672ba1 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf @@ -842,9 +842,9 @@ O tipo de ponto de entrada para realizar marshaling '{0}' para o tipo gerenciado '{1}' deve ter uma aridade maior do que o tipo gerenciado. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Todos os marshallers de valores passados como o valor retornado não gerenciado devem ter o mesmo tipo não gerenciado. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf index 394a0e09d2a127..0c6446ff0d2715 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf @@ -842,9 +842,9 @@ Тип точки входа маршаллера "{0}" для управляемого типа "{1}" должен иметь более высокую арность, чем управляемый тип. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Все маршалеры для значений, передаваемых в качестве неуправляемого возвращаемого значения, должны использовать одинаковый неуправляемый тип. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf index 6d7c166203d76d..3a4095b184df76 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf @@ -842,9 +842,9 @@ Yönetilen tür '{1}' için sıralayıcı giriş noktası '{0}', yönetilen türden büyük bir parametre sayısına sahip olmalıdır. - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - Yönetilmeyen dönüş değeri olarak geçirilen değerler için tüm hazırlayıcılar aynı yönetilmeyen türe sahip olmalıdır. + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf index 2df445d4f9feba..8290f2528c338c 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -842,9 +842,9 @@ 托管类型“{1}”的封送程序入口点类型“{0}”必须具有大于托管类型的 arity。 - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - 作为非托管返回值传递的值的所有封送程序必须具有相同的非托管类型。 + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf index 07248b19e3e7e5..e98e23423531a2 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -842,9 +842,9 @@ 受控類型 '{1}' 的封送處理器進入點類型 '{0}' 必須具有大於受控類型的 arity。 - - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - 以非受控傳回值傳遞之值的所有封送處理常式,都必須具有相同的非受控類型。 + + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. + All marshallers for values that are passed as the unmanaged return value or parameter must have the same unmanaged type. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/BoundGenerators.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/BoundGenerators.cs index 335aca92cab2a9..c517a0c0353999 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/BoundGenerators.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/BoundGenerators.cs @@ -66,29 +66,60 @@ public static BoundGenerators Create(ImmutableArray elementTyp } } - // Sort the parameter marshallers by index to ensure that we handle them in order when producing signatures. - managedParamMarshallers.Sort(static (m1, m2) => m1.TypeInfo.ManagedIndex.CompareTo(m2.TypeInfo.ManagedIndex)); - nativeParamMarshallers.Sort(static (m1, m2) => m1.TypeInfo.NativeIndex.CompareTo(m2.TypeInfo.NativeIndex)); // Now that we've processed all of the signature marshallers, // we'll handle the special ones that might depend on them, like the exception marshaller. if (managedExceptionInfo is not null) { + // The managed exception marshaller may overlap with another marshaller in the native position. + // In that case, we need to validate some additional invariants. + // Also, some cases may require an overlap, such as when using the "COM" exception marshalling. + IBoundMarshallingGenerator? overlappedMarshaller = null; + if (managedExceptionInfo.IsNativeReturnPosition) + { + overlappedMarshaller = nativeReturnMarshaller; + } + else if (managedExceptionInfo.NativeIndex is not (TypePositionInfo.UnsetIndex or TypePositionInfo.ExceptionIndex)) + { + overlappedMarshaller = nativeParamMarshallers.FirstOrDefault(e => e.TypeInfo.NativeIndex == managedExceptionInfo.NativeIndex); + } + if (managedExceptionInfo.MarshallingAttributeInfo is ComExceptionMarshalling) { - managedExceptionInfo = managedExceptionInfo with + if (overlappedMarshaller is null) + { + generatorDiagnostics.Add(new GeneratorDiagnostic.NotSupported(managedExceptionInfo)); + } + else { - MarshallingAttributeInfo = ComExceptionMarshalling.CreateSpecificMarshallingInfo(nativeReturnMarshaller.NativeType) - }; + managedExceptionInfo = managedExceptionInfo with + { + MarshallingAttributeInfo = ComExceptionMarshalling.CreateSpecificMarshallingInfo(overlappedMarshaller.NativeType) + }; + } } - IMarshallingGeneratorResolver exceptionHandlerFactory = new ExtendedInvariantsValidator(nativeReturnMarshaller.NativeType, generatorResolver); + IMarshallingGeneratorResolver exceptionHandlerFactory = generatorResolver; + + if (overlappedMarshaller is not null) + { + exceptionHandlerFactory = new MatchingNativeTypeValidator(overlappedMarshaller.NativeType, exceptionHandlerFactory); + } - // We explicitly don't include exceptionMarshaller in the signatureMarshallers collection - // as it needs to be specially emitted. managedExceptionMarshaller = CreateGenerator(managedExceptionInfo, generatorResolver); + + if (overlappedMarshaller is null && !TypePositionInfo.IsSpecialIndex(managedExceptionInfo.NativeIndex)) + { + // If the exception marshaller doesn't overlap with another marshaller but has a native index, + // we need to add it to the list of native parameter marshallers. + nativeParamMarshallers.Add(managedExceptionMarshaller); + } } + // Sort the parameter marshallers by index to ensure that we handle them in order when producing signatures. + managedParamMarshallers.Sort(static (m1, m2) => m1.TypeInfo.ManagedIndex.CompareTo(m2.TypeInfo.ManagedIndex)); + nativeParamMarshallers.Sort(static (m1, m2) => m1.TypeInfo.NativeIndex.CompareTo(m2.TypeInfo.NativeIndex)); + generatorBindingDiagnostics = generatorDiagnostics.ToImmutable(); return new BoundGenerators() @@ -134,7 +165,7 @@ public static BoundGenerators Create(ImmutableArray elementTyp { return Array.Empty<(bool, int)>(); } - return MarshallerHelpers.GetDependentElementsOfMarshallingInfo(info.MarshallingAttributeInfo) + return info.MarshallingAttributeInfo.ElementDependencies .Select(static info => GetInfoIndex(info)).ToImmutableArray(); } @@ -190,31 +221,24 @@ IBoundMarshallingGenerator CreateGenerator(TypePositionInfo p, IMarshallingGener public bool HasManagedExceptionMarshaller => !ManagedExceptionMarshaller.IsForwarder(); - private sealed class ExtendedInvariantsValidator : IMarshallingGeneratorResolver + /// + /// Validate that the resolved generator resolves to the same native type. + /// + private sealed class MatchingNativeTypeValidator(ManagedTypeInfo requiredNativeType, IMarshallingGeneratorResolver inner) : IMarshallingGeneratorResolver { - private readonly ManagedTypeInfo _nativeReturnType; - private readonly IMarshallingGeneratorResolver _inner; - - public ExtendedInvariantsValidator(ManagedTypeInfo nativeReturnType, IMarshallingGeneratorResolver inner) - { - _nativeReturnType = nativeReturnType; - _inner = inner; - } - public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) { - ResolvedGenerator generator = _inner.Create(info, context); + ResolvedGenerator generator = inner.Create(info, context); if (!generator.IsResolvedWithoutErrors) { return generator; } // Marshallers that share the native return position must have the same native return type. - if (info.IsNativeReturnPosition - && generator.Generator.NativeType != _nativeReturnType) + if (generator.Generator.NativeType != requiredNativeType) { return ResolvedGenerator.NotSupported(info, context, new(info) { - NotSupportedDetails = SR.MarshallerInNativeReturnPositionMustMatchNativeReturnType + NotSupportedDetails = SR.MarshallerInOverlappingNativePositionMustMatchNativeType }); } return generator; diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/MarshallerHelpers.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/MarshallerHelpers.cs index d37849547d1a21..45b1ad734483dd 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/MarshallerHelpers.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/MarshallerHelpers.cs @@ -229,33 +229,6 @@ public bool AnyIncomingEdge(int to) } } - public static IEnumerable GetDependentElementsOfMarshallingInfo( - MarshallingInfo elementMarshallingInfo) - { - if (elementMarshallingInfo is NativeLinearCollectionMarshallingInfo nestedCollection) - { - if (nestedCollection.ElementCountInfo is CountElementCountInfo { ElementInfo: TypePositionInfo nestedCountElement }) - { - // Do not include dependent elements with no managed or native index. - // These values are dummy values that are inserted earlier to avoid emitting extra diagnostics. - if (nestedCountElement.ManagedIndex != TypePositionInfo.UnsetIndex || nestedCountElement.NativeIndex != TypePositionInfo.UnsetIndex) - { - yield return nestedCountElement; - } - } - foreach (KeyValuePair mode in nestedCollection.Marshallers.Modes) - { - foreach (TypePositionInfo nestedElement in GetDependentElementsOfMarshallingInfo(mode.Value.CollectionElementMarshallingInfo)) - { - if (nestedElement.ManagedIndex != TypePositionInfo.UnsetIndex || nestedElement.NativeIndex != TypePositionInfo.UnsetIndex) - { - yield return nestedElement; - } - } - } - } - } - // private static readonly InvocationExpressionSyntax SkipInitInvocation = public static StatementSyntax SkipInitOrDefaultInit(TypePositionInfo info, StubIdentifierContext context) { diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallingAttributeInfo.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallingAttributeInfo.cs index 36f56c08bc72c1..6dcc8b97fcedb3 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallingAttributeInfo.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallingAttributeInfo.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -35,6 +36,8 @@ public abstract record MarshallingInfo { protected MarshallingInfo() { } + + public virtual IEnumerable ElementDependencies => []; } /// @@ -117,7 +120,40 @@ public sealed record NativeLinearCollectionMarshallingInfo( CountInfo ElementCountInfo, ManagedTypeInfo PlaceholderTypeParameter) : NativeMarshallingAttributeInfo( EntryPointType, - Marshallers); + Marshallers) + { + public override IEnumerable ElementDependencies + { + get + { + return field ??= GetElementDependencies().ToImmutableArray(); + + IEnumerable GetElementDependencies() + { + if (ElementCountInfo is CountElementCountInfo { ElementInfo: TypePositionInfo nestedCountElement }) + { + // Do not include dependent elements with no managed or native index. + // These values are dummy values that are inserted earlier to avoid emitting extra diagnostics. + if (nestedCountElement.ManagedIndex != TypePositionInfo.UnsetIndex || nestedCountElement.NativeIndex != TypePositionInfo.UnsetIndex) + { + yield return nestedCountElement; + } + } + + foreach (KeyValuePair mode in Marshallers.Modes) + { + foreach (TypePositionInfo nestedElement in mode.Value.CollectionElementMarshallingInfo.ElementDependencies) + { + if (nestedElement.ManagedIndex != TypePositionInfo.UnsetIndex || nestedElement.NativeIndex != TypePositionInfo.UnsetIndex) + { + yield return nestedElement; + } + } + } + } + } + } + } /// /// Marshal an exception based on the same rules as the built-in COM system based on the unmanaged type of the native return marshaller. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/UnmanagedToManagedStubGenerator.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/UnmanagedToManagedStubGenerator.cs similarity index 98% rename from src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/UnmanagedToManagedStubGenerator.cs rename to src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/UnmanagedToManagedStubGenerator.cs index 04897fb03d7630..bdc27c6555ea19 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/UnmanagedToManagedStubGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/UnmanagedToManagedStubGenerator.cs @@ -11,7 +11,7 @@ namespace Microsoft.Interop { - internal sealed class UnmanagedToManagedStubGenerator + public sealed class UnmanagedToManagedStubGenerator { private const string ReturnIdentifier = "__retVal"; diff --git a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/VariableDeclarations.cs b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/VariableDeclarations.cs index fb10fd2f74aaed..db65df307c5eb2 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/VariableDeclarations.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/VariableDeclarations.cs @@ -164,7 +164,9 @@ static void AppendVariableDeclarations(ImmutableArray