Skip to content
24 changes: 14 additions & 10 deletions .openpublishing.redirection.fundamentals.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,45 +441,49 @@
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1089.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1070-1089"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1090-1099.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1090.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1091.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1092.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1093.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1094.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1095.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1096.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1097.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1098.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1099.md",
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib1090-1099"
"redirect_url": "/dotnet/fundamentals/syslib-diagnostics/syslib-cominterfacegenerator"
},
{
"source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1100.md",
Expand Down
22 changes: 12 additions & 10 deletions docs/fundamentals/syslib-diagnostics/source-generator-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6
| [SYSLIB1227][1227] | (Reserved for System.Text.Json.SourceGeneration.) |
| [SYSLIB1228][1228] | (Reserved for System.Text.Json.SourceGeneration.) |
| [SYSLIB1229][1229] | (Reserved for System.Text.Json.SourceGeneration.) |
| [SYSLIB1230][1230] | Deriving from a `GeneratedComInterface`-attributed interface defined in another assembly is not supported. |

<!-- Include adds ## Suppress warnings (H2 heading) -->
[!INCLUDE [suppress-source-generator-diagnostics](includes/suppress-source-generator-diagnostics.md)]
Expand Down Expand Up @@ -253,16 +254,16 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6
[1087]: syslib1070-1089.md
[1088]: syslib1070-1089.md
[1089]: syslib1070-1089.md
[1090]: syslib1090-1099.md
[1091]: syslib1090-1099.md
[1092]: syslib1090-1099.md
[1093]: syslib1090-1099.md
[1094]: syslib1090-1099.md
[1095]: syslib1090-1099.md
[1096]: syslib1090-1099.md
[1097]: syslib1090-1099.md
[1098]: syslib1090-1099.md
[1099]: syslib1090-1099.md
[1090]: syslib-cominterfacegenerator.md
[1091]: syslib-cominterfacegenerator.md
[1092]: syslib-cominterfacegenerator.md
[1093]: syslib-cominterfacegenerator.md
[1094]: syslib-cominterfacegenerator.md
[1095]: syslib-cominterfacegenerator.md
[1096]: syslib-cominterfacegenerator.md
[1097]: syslib-cominterfacegenerator.md
[1098]: syslib-cominterfacegenerator.md
[1099]: syslib-cominterfacegenerator.md
[1100]: syslib1100-1118.md
[1101]: syslib1100-1118.md
[1102]: syslib1100-1118.md
Expand Down Expand Up @@ -311,3 +312,4 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6
[1227]: syslib1220-1229.md
[1228]: syslib1220-1229.md
[1229]: syslib1220-1229.md
[1230]: syslib1230.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: SYSLIB diagnostics for Microsoft.Interop.COMInteropGenerator
description: Learn about the COM interop source-generation analyzers that generate compile-time suggestions SYSLIB1090 through SYSLIB1099.
ms.date: 10/28/2023
title: SYSLIB diagnostics for Microsoft.Interop.ComInterfaceGenerator
description: Learn about the COM interop source-generation analyzers that generate compile-time suggestions SYSLIB1090 through SYSLIB1099 and SYSLIB1230 through SYSLIB1239.
ms.date: 10/08/2024
f1_keywords:
- syslib1090
- syslib1091
Expand All @@ -16,12 +16,12 @@ f1_keywords:
---
# SYSLIB diagnostics for COM interop source generation

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

| Diagnostic ID | Description |
| - | - |
| `SYSLIB1090` | Invalid `GeneratedComInterfaceAttribute` usage. |
| `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. |
| Diagnostic ID | Description |
|---------------|-------------------------------------------------|
| `SYSLIB1090` | Invalid `GeneratedComInterfaceAttribute` usage. |
| `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. |
| `SYSLIB1092` | Usage of `LibraryImport` or `GeneratedComInterface` attribute does not follow recommendation. |
| `SYSLIB1093` | Analysis for COM interface generation has failed. |
| `SYSLIB1094` | The base COM interface failed to generate source. Code will not be generated for this interface. |
Expand All @@ -30,3 +30,4 @@ The following table shows the diagnostic IDs for COM interop source-generation a
| `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. |
| `SYSLIB1098` | .NET COM hosting with `EnableComHosting` only supports built-in COM interop. It does not support source-generated COM interop with `GeneratedComInterfaceAttribute`. |
| `SYSLIB1099` | COM Interop APIs on `System.Runtime.InteropServices.Marshal` do not support source-generated COM and will fail at run time. |
| [`SYSLIB1230`](syslib1230.md) | Deriving from a `GeneratedComInterface`-attributed interface defined in another assembly is not supported. |
36 changes: 36 additions & 0 deletions docs/fundamentals/syslib-diagnostics/syslib1230.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: SYSLIB1230 warning
description: Learn about the diagnostic that generates compile-time warning SYSLIB1230.
ms.date: 10/08/2024
f1_keywords:
- syslib1230
---

# SYSLIB1230: Deriving from a `GeneratedComInterface`-attributed interface defined in another assembly is not supported

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:

- The base interface type must be compiled targeting the same framework as the derived type.
- The base interface type must not shadow any members of its base interface, if it has one.

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.

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:

```csharp
// Disable the warning.
#pragma warning disable SYSLIB1230
[GeneratedComInterface]
interface IDerived : IBaseInOtherAssembly
// Re-enable the warning.
#pragma warning restore SYSLIB1230
{
// the interface definition
}
```

[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)]

## See also

- [SYSLIB diagnostics for COM interop source generation](syslib-cominterfacegenerator.md)
5 changes: 4 additions & 1 deletion docs/navigate/tools-diagnostics/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ items:
href: ../../fundamentals/syslib-diagnostics/syslib1070-1089.md
displayProperty: syslib1071, syslib1072, syslib1073, syslib1074, syslib1075, syslib1076, syslib1077, syslib1078, syslib1079, syslib1080, syslib1081, syslib1082, syslib1083, syslib1084, syslib1085, syslib1086, syslib1087, syslib1088, syslib1089
- name: SYSLIB1090-SYSLIB1099
href: ../../fundamentals/syslib-diagnostics/syslib1090-1099.md
href: ../../fundamentals/syslib-diagnostics/syslib-cominterfacegenerator.md
displayProperty: syslib1091, syslib1092, syslib1093, syslib1094, syslib1095, syslib1096, syslib1097, syslib1098, syslib1099
- name: SYSLIB1100-SYSLIB1118
href: ../../fundamentals/syslib-diagnostics/syslib1100-1118.md
Expand All @@ -1890,6 +1890,9 @@ items:
- name: SYSLIB1220-SYSLIB1229
href: ../../fundamentals/syslib-diagnostics/syslib1220-1229.md
displayProperty: syslib1220, syslib1221, syslib1222, syslib1223, syslib1224, syslib1225, syslib1226, syslib1227, syslib1228, syslib1229
- name: SYSLIB1230
href: ../../fundamentals/syslib-diagnostics/syslib1230.md
displayProperty: syslib1230, syslib1231, syslib1232, syslib1233, syslib1234, syslib1235, syslib1236, syslib1237, syslib1238, syslib1239
- name: API compatibility
items:
- name: Overview
Expand Down
Loading