Skip to content

Commit d002a6f

Browse files
authored
Add docs for SYSLIB1230 (#42884)
1 parent 2a70c23 commit d002a6f

File tree

5 files changed

+75
-29
lines changed

5 files changed

+75
-29
lines changed

.openpublishing.redirection.fundamentals.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -441,45 +441,49 @@
441441
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1089.md",
442442
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1070-1089"
443443
},
444+
{
445+
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1090-1099.md",
446+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
447+
},
444448
{
445449
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1090.md",
446-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
450+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
447451
},
448452
{
449453
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1091.md",
450-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
454+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
451455
},
452456
{
453457
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1092.md",
454-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
458+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
455459
},
456460
{
457461
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1093.md",
458-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
462+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
459463
},
460464
{
461465
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1094.md",
462-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
466+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
463467
},
464468
{
465469
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1095.md",
466-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
470+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
467471
},
468472
{
469473
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1096.md",
470-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
474+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
471475
},
472476
{
473477
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1097.md",
474-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
478+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
475479
},
476480
{
477481
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1098.md",
478-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
482+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
479483
},
480484
{
481485
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1099.md",
482-
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
486+
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
483487
},
484488
{
485489
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1100.md",

docs/fundamentals/syslib-diagnostics/source-generator-overview.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6
167167
| [SYSLIB1227][1227] | (Reserved for System.Text.Json.SourceGeneration.) |
168168
| [SYSLIB1228][1228] | (Reserved for System.Text.Json.SourceGeneration.) |
169169
| [SYSLIB1229][1229] | (Reserved for System.Text.Json.SourceGeneration.) |
170+
| [SYSLIB1230][1230] | Deriving from a `GeneratedComInterface`-attributed interface defined in another assembly is not supported. |
170171

171172
<!-- Include adds ## Suppress warnings (H2 heading) -->
172173
[!INCLUDE [suppress-source-generator-diagnostics](includes/suppress-source-generator-diagnostics.md)]
@@ -253,16 +254,16 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6
253254
[1087]: syslib1070-1089.md
254255
[1088]: syslib1070-1089.md
255256
[1089]: syslib1070-1089.md
256-
[1090]: syslib1090-1099.md
257-
[1091]: syslib1090-1099.md
258-
[1092]: syslib1090-1099.md
259-
[1093]: syslib1090-1099.md
260-
[1094]: syslib1090-1099.md
261-
[1095]: syslib1090-1099.md
262-
[1096]: syslib1090-1099.md
263-
[1097]: syslib1090-1099.md
264-
[1098]: syslib1090-1099.md
265-
[1099]: syslib1090-1099.md
257+
[1090]: syslib-cominterfacegenerator.md
258+
[1091]: syslib-cominterfacegenerator.md
259+
[1092]: syslib-cominterfacegenerator.md
260+
[1093]: syslib-cominterfacegenerator.md
261+
[1094]: syslib-cominterfacegenerator.md
262+
[1095]: syslib-cominterfacegenerator.md
263+
[1096]: syslib-cominterfacegenerator.md
264+
[1097]: syslib-cominterfacegenerator.md
265+
[1098]: syslib-cominterfacegenerator.md
266+
[1099]: syslib-cominterfacegenerator.md
266267
[1100]: syslib1100-1118.md
267268
[1101]: syslib1100-1118.md
268269
[1102]: syslib1100-1118.md
@@ -311,3 +312,4 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6
311312
[1227]: syslib1220-1229.md
312313
[1228]: syslib1220-1229.md
313314
[1229]: syslib1220-1229.md
315+
[1230]: syslib1230.md
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: SYSLIB diagnostics for Microsoft.Interop.COMInteropGenerator
3-
description: Learn about the COM interop source-generation analyzers that generate compile-time suggestions SYSLIB1090 through SYSLIB1099.
4-
ms.date: 10/28/2023
2+
title: SYSLIB diagnostics for Microsoft.Interop.ComInterfaceGenerator
3+
description: Learn about the COM interop source-generation analyzers that generate compile-time suggestions SYSLIB1090 through SYSLIB1099 and SYSLIB1230 through SYSLIB1239.
4+
ms.date: 10/08/2024
55
f1_keywords:
66
- syslib1090
77
- syslib1091
@@ -16,12 +16,12 @@ f1_keywords:
1616
---
1717
# SYSLIB diagnostics for COM interop source generation
1818

19-
The following table shows the diagnostic IDs for COM interop source-generation analyzers in .NET 8 and later versions.
19+
The following table shows the diagnostic IDs for COM interop source-generation analyzers.
2020

21-
| Diagnostic ID | Description |
22-
| - | - |
23-
| `SYSLIB1090` | Invalid `GeneratedComInterfaceAttribute` usage. |
24-
| `SYSLIB1091` | Method is declared in different partial declaration than the `GeneratedComInterface` attribute. To ensure reliable calculation for virtual method table offsets, all methods must be declared in the same partial definition of a `GeneratedComInterface`-attributed interface type. |
21+
| Diagnostic ID | Description |
22+
|---------------|-------------------------------------------------|
23+
| `SYSLIB1090` | Invalid `GeneratedComInterfaceAttribute` usage. |
24+
| `SYSLIB1091` | Method is declared in different partial declaration than the `GeneratedComInterface` attribute. To ensure reliable calculation for virtual method table offsets, all methods must be declared in the same partial definition of a `GeneratedComInterface`-attributed interface type. |
2525
| `SYSLIB1092` | Usage of `LibraryImport` or `GeneratedComInterface` attribute does not follow recommendation. |
2626
| `SYSLIB1093` | Analysis for COM interface generation has failed. |
2727
| `SYSLIB1094` | The base COM interface failed to generate source. Code will not be generated for this interface. |
@@ -30,3 +30,4 @@ The following table shows the diagnostic IDs for COM interop source-generation a
3030
| `SYSLIB1097` | This type implements at least one type with the `GeneratedComInterfaceAttribute` attribute. Add the `GeneratedComClassAttribute` to enable passing this type to COM and exposing the COM interfaces for the types with the `GeneratedComInterfaceAttribute` from objects of this type. |
3131
| `SYSLIB1098` | .NET COM hosting with `EnableComHosting` only supports built-in COM interop. It does not support source-generated COM interop with `GeneratedComInterfaceAttribute`. |
3232
| `SYSLIB1099` | COM Interop APIs on `System.Runtime.InteropServices.Marshal` do not support source-generated COM and will fail at run time. |
33+
| [`SYSLIB1230`](syslib1230.md) | Deriving from a `GeneratedComInterface`-attributed interface defined in another assembly is not supported. |
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: SYSLIB1230 warning
3+
description: Learn about the diagnostic that generates compile-time warning SYSLIB1230.
4+
ms.date: 10/08/2024
5+
f1_keywords:
6+
- syslib1230
7+
---
8+
9+
# SYSLIB1230: Deriving from a `GeneratedComInterface`-attributed interface defined in another assembly is not supported
10+
11+
In .NET 9 and later versions, defining an interface with the <xref:System.Runtime.InteropServices.Marshalling.GeneratedComInterfaceAttribute> attribute that derives from a `GeneratedComInterface`-attributed interface that's defined in another assembly is supported with the following restrictions:
12+
13+
- The base interface type must be compiled targeting the same framework as the derived type.
14+
- The base interface type must not shadow any members of its base interface, if it has one.
15+
16+
Additionally, any changes to any generated virtual method offsets in the base interface chain defined in another assembly won't be accounted for in the derived interfaces until the project is rebuilt.
17+
18+
When you define an interface with the <xref:System.Runtime.InteropServices.Marshalling.GeneratedComInterfaceAttribute> attribute that derives from a `GeneratedComInterface`-attributed interface that's defined in another assembly, the SYSLIB1230 warning is emitted to inform you of the limitations. To acknowledge the limitations, suppress the warning in code as follows:
19+
20+
```csharp
21+
// Disable the warning.
22+
#pragma warning disable SYSLIB1230
23+
[GeneratedComInterface]
24+
interface IDerived : IBaseInOtherAssembly
25+
// Re-enable the warning.
26+
#pragma warning restore SYSLIB1230
27+
{
28+
// the interface definition
29+
}
30+
```
31+
32+
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)]
33+
34+
## See also
35+
36+
- [SYSLIB diagnostics for COM interop source generation](syslib-cominterfacegenerator.md)

docs/navigate/tools-diagnostics/toc.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@ items:
18791879
href: ../../fundamentals/syslib-diagnostics/syslib1070-1089.md
18801880
displayProperty: syslib1071, syslib1072, syslib1073, syslib1074, syslib1075, syslib1076, syslib1077, syslib1078, syslib1079, syslib1080, syslib1081, syslib1082, syslib1083, syslib1084, syslib1085, syslib1086, syslib1087, syslib1088, syslib1089
18811881
- name: SYSLIB1090-SYSLIB1099
1882-
href: ../../fundamentals/syslib-diagnostics/syslib1090-1099.md
1882+
href: ../../fundamentals/syslib-diagnostics/syslib-cominterfacegenerator.md
18831883
displayProperty: syslib1091, syslib1092, syslib1093, syslib1094, syslib1095, syslib1096, syslib1097, syslib1098, syslib1099
18841884
- name: SYSLIB1100-SYSLIB1118
18851885
href: ../../fundamentals/syslib-diagnostics/syslib1100-1118.md
@@ -1890,6 +1890,9 @@ items:
18901890
- name: SYSLIB1220-SYSLIB1229
18911891
href: ../../fundamentals/syslib-diagnostics/syslib1220-1229.md
18921892
displayProperty: syslib1220, syslib1221, syslib1222, syslib1223, syslib1224, syslib1225, syslib1226, syslib1227, syslib1228, syslib1229
1893+
- name: SYSLIB1230
1894+
href: ../../fundamentals/syslib-diagnostics/syslib1230.md
1895+
displayProperty: syslib1230, syslib1231, syslib1232, syslib1233, syslib1234, syslib1235, syslib1236, syslib1237, syslib1238, syslib1239
18931896
- name: API compatibility
18941897
items:
18951898
- name: Overview

0 commit comments

Comments
 (0)