You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two projects, one console app project, referencing another class library project. One interface IMy is declared in the class library, and another interface IMy3 is declared in the console app and derives from IMy
Both projects are using ComWrappers source generation feature (GeneratedComInterface).
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;
namespace AotTest
{
[GeneratedComInterface, Guid("68207504-314f-492a-b4f2-fbc1838e6ac3")]
public partial interface IMy
{
}
[GeneratedComInterface, Guid("80511349-dff5-4c5e-839b-af4735977ebf")]
public partial interface IMy2 : IMy // this derived one works fine
{
}
}
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;
namespace AotTest.Cli
{
internal class Program
{
static void Main()
{
Console.WriteLine("Hello, World!");
}
}
[GeneratedComInterface, Guid("755293e8-fe80-4654-aee3-732fefaaf3e0")]
public partial interface IMy3 : IMy
{
}
}
Expected behavior
I don't see why it shouldn't compile, I hope this simple scenario is supported.
Actual behavior
I get compilation error:
1>------ Build started: Project: AotTest, Configuration: Debug Any CPU ------
1>AotTest -> E:\smo\work\AotTest\AotTest\bin\Debug\net8.0\AotTest.dll
2>------ Build started: Project: AotTest.Cli, Configuration: Debug Any CPU ------
2>E:\smo\work\AotTest\AotTest.Cli\Program.cs(15,30,15,34): error SYSLIB1094: COM interface AotTest.Cli.IMy3 inherits from AotTest.IMy, which has errors. ComInterfaceGenerator will not generate source for AotTest.Cli.IMy3. (https://learn.microsoft.com/dotnet/fundamentals/syslib-diagnostics/syslib1094)
2>Done building project "AotTest.Cli.csproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Also, independently from the SYSLIB1094 error, Roslyn seems to crash (but not always, seems more a background thing) this is what I see (sometimes) in Visual Studio and it seems somehow related (I have a bigger project where these top error lines popup continuously):
Here is the stack trace from the first error line:
StreamJsonRpc.RemoteInvocationException: SyntaxTree is not part of the compilation (Parameter 'syntaxTree')
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__154`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__20`1.MoveNext()
RPC server exception:
System.ArgumentException: SyntaxTree is not part of the compilation (Parameter 'syntaxTree')
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options)
at Microsoft.CodeAnalysis.Diagnostics.SuppressMessageAttributeState.IsDiagnosticSuppressed(Diagnostic diagnostic, SuppressMessageInfo& info)
at Microsoft.CodeAnalysis.Diagnostics.SuppressMessageAttributeState.ApplySourceSuppressions(Diagnostic diagnostic)
at Microsoft.CodeAnalysis.GeneratorDriver.FilterDiagnostics(Compilation compilation, ImmutableArray`1 generatorDiagnostics, DiagnosticBag driverDiagnostics, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsCore(Compilation compilation, DiagnosticBag diagnosticsBag, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.GeneratorDriver.RunGenerators(Compilation compilation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.ComputeNewGeneratorInfoInCurrentProcessAsync(ISourceGeneratorTelemetryCollectorWorkspaceService telemetryCollector, Compilation compilationWithoutGeneratedFiles, TextDocumentStates`1 oldGeneratedDocuments, GeneratorDriver generatorDriver, Compilation compilationWithStaleGeneratedTrees, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.ComputeNewGeneratorInfoAsync(SolutionCompilationState compilationState, Compilation compilationWithoutGeneratedFiles, TextDocumentStates`1 oldGeneratedDocuments, GeneratorDriver oldGeneratorDriver, Compilation compilationWithStaleGeneratedTrees, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.AddExistingOrComputeNewGeneratorInfoAsync(CreationPolicy creationPolicy, SolutionCompilationState compilationState, Compilation compilationWithoutGeneratedFiles, CompilationTrackerGeneratorInfo generatorInfo, Compilation compilationWithStaleGeneratedTrees, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.<>c__DisplayClass23_0.<<GetOrBuildFinalStateAsync>g__FinalizeCompilationWorkerAsync|4>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.<>c__DisplayClass23_0.<<GetOrBuildFinalStateAsync>g__FinalizeCompilationAsync|3>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.<>c__DisplayClass23_0.<<GetOrBuildFinalStateAsync>g__BuildFinalStateAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.GetOrBuildFinalStateAsync(SolutionCompilationState compilationState, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.SolutionCompilationState.CompilationTracker.GetSourceGeneratedDocumentStatesAsync(SolutionCompilationState compilationState, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteSourceGenerationService.<>c__DisplayClass2_0.<<GetSourceGenerationInfoAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass8_0`1.<<RunWithSolutionAsync>g__ProcessSolutionAsync|1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunWithSolutionAsync[T](Checksum solutionChecksum, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunServiceImplAsync[T](Func`2 implementation, CancellationToken cancellationToken)
Regression?
I don't tink so but I can't be sure.
Known Workarounds
I don't have any.
Configuration
.NET 8.0.5, Visual Studio 17.10.0 (latest), Windows 11 x64
Description
I have two projects, one console app project, referencing another class library project. One interface
IMy
is declared in the class library, and another interfaceIMy3
is declared in the console app and derives fromIMy
Both projects are using ComWrappers source generation feature (
GeneratedComInterface
).I cannot compile the console application.
Reproduction Steps
Here the class library project:
Contains only one file IMy.cs:
Here's the console app project:
contains only one file Program.cs:
Expected behavior
I don't see why it shouldn't compile, I hope this simple scenario is supported.
Actual behavior
I get compilation error:
Also, independently from the SYSLIB1094 error, Roslyn seems to crash (but not always, seems more a background thing) this is what I see (sometimes) in Visual Studio and it seems somehow related (I have a bigger project where these top error lines popup continuously):
Here is the stack trace from the first error line:
Regression?
I don't tink so but I can't be sure.
Known Workarounds
I don't have any.
Configuration
.NET 8.0.5, Visual Studio 17.10.0 (latest), Windows 11 x64
Here's a reproducing solution
AotTest.zip
Other information
No response
The text was updated successfully, but these errors were encountered: