Erik SImonič
System.Drawing.Printing or System.Printing unsupported under Windows Service.
Hi, both namespaces have the same warning.
Caution
Classes within the System.Printing namespace are not supported for use within a Windows service or ASP.NET application or service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.
Does someone know what is all about.
Thank you!
1 replies
✅ CompletionService.GetService on document returns NULL in Net7 worked fine in Net6 Solved,
Fixed, by adding
Microsoft.CodeAnalysis.Features
Microsoft.CodeAnalysis.CSharp.Features
versions.
Hi, I have a problem with mentioned method,
var workspace = new AdhocWorkspace();
var compilationOptions = new CSharpCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
usings: new[]
{
"System", "System.Linq"
});
var projectInfo = ProjectInfo.Create(ProjectId.CreateNewId(), VersionStamp.Create(), "SampleProject",
"SampleProject", LanguageNames.CSharp)
.WithMetadataReferences(Net70.References.All)
.WithCompilationOptions(compilationOptions);
var project = workspace.AddProject(projectInfo);
// Add the Customer class as an additional document
var customerClassCode = """
"""; var customerDocument = project.AddDocument("Customer.cs", SourceText.From(customerClassCode)); var customerDocumentProject = customerDocument.Project; var compilationAsync = await customerDocumentProject.GetCompilationAsync(); var immutableArray = compilationAsync.GetDiagnostics(); // Assert.DoesNotContain(immutableArray, x=>x.Severity == DiagnosticSeverity.Error); var position = customerClassCode.LastIndexOf('.') + 2; var completionService = CompletionService.GetService(customerDocument); var results = await completionService.GetCompletionsAsync(customerDocument, position); Assert.Contains(results.ItemsList, x => x.DisplayText == "Name");
"""; var customerDocument = project.AddDocument("Customer.cs", SourceText.From(customerClassCode)); var customerDocumentProject = customerDocument.Project; var compilationAsync = await customerDocumentProject.GetCompilationAsync(); var immutableArray = compilationAsync.GetDiagnostics(); // Assert.DoesNotContain(immutableArray, x=>x.Severity == DiagnosticSeverity.Error); var position = customerClassCode.LastIndexOf('.') + 2; var completionService = CompletionService.GetService(customerDocument); var results = await completionService.GetCompletionsAsync(customerDocument, position); Assert.Contains(results.ItemsList, x => x.DisplayText == "Name");
5 replies