Rename and update logging
This commit is contained in:
@@ -6,6 +6,6 @@ public class Progress : IProgress<ProjectLoadProgress>
|
|||||||
{
|
{
|
||||||
public void Report(ProjectLoadProgress value)
|
public void Report(ProjectLoadProgress value)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{value.Operation} completed for {value.FilePath} ({value.TargetFramework}) in {value.ElapsedTime.TotalMilliseconds}ms");
|
//Console.WriteLine($"{value.Operation} completed for {value.FilePath} ({value.TargetFramework}) in {value.ElapsedTime.TotalMilliseconds}ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,24 +5,25 @@ using Microsoft.CodeAnalysis.MSBuild;
|
|||||||
|
|
||||||
namespace SharpIDE.Application.Features.Analysis;
|
namespace SharpIDE.Application.Features.Analysis;
|
||||||
|
|
||||||
public static class RoslynTest
|
public static class RoslynAnalysis
|
||||||
{
|
{
|
||||||
public static async Task Analyse(string solutionFilePath)
|
public static async Task Analyse(string solutionFilePath)
|
||||||
{
|
{
|
||||||
var workspace = MSBuildWorkspace.Create();
|
Console.WriteLine($"RoslynAnalysis: Loading solution");
|
||||||
var timer = Stopwatch.StartNew();
|
var timer = Stopwatch.StartNew();
|
||||||
|
var workspace = MSBuildWorkspace.Create();
|
||||||
workspace.WorkspaceFailed += (o, e) => throw new InvalidOperationException($"Workspace failed: {e.Diagnostic.Message}");
|
workspace.WorkspaceFailed += (o, e) => throw new InvalidOperationException($"Workspace failed: {e.Diagnostic.Message}");
|
||||||
var solution = await workspace.OpenSolutionAsync(solutionFilePath, new Progress());
|
var solution = await workspace.OpenSolutionAsync(solutionFilePath, new Progress());
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
Console.WriteLine($"RoslynTest: Solution loaded in {timer.ElapsedMilliseconds}ms");
|
Console.WriteLine($"RoslynAnalysis: Solution loaded in {timer.ElapsedMilliseconds}ms");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|
||||||
foreach (var project in solution.Projects)
|
foreach (var project in solution.Projects)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Project: {project.Name}");
|
//Console.WriteLine($"Project: {project.Name}");
|
||||||
foreach (var document in project.Documents)
|
foreach (var document in project.Documents)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Document: {document.Name}");
|
//Console.WriteLine($"Document: {document.Name}");
|
||||||
// var compilation = await project.GetCompilationAsync();
|
// var compilation = await project.GetCompilationAsync();
|
||||||
// Guard.Against.Null(compilation, nameof(compilation));
|
// Guard.Against.Null(compilation, nameof(compilation));
|
||||||
//
|
//
|
||||||
@@ -13,7 +13,7 @@ public static class ProjectEvaluation
|
|||||||
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding);
|
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding);
|
||||||
|
|
||||||
var project = _projectCollection.LoadProject(projectFilePath);
|
var project = _projectCollection.LoadProject(projectFilePath);
|
||||||
Console.WriteLine($"Project loaded: {project.FullPath}");
|
Console.WriteLine($"ProjectEvaluation: loaded {project.FullPath}");
|
||||||
//var outputType = project.GetProperty("OutputType");
|
//var outputType = project.GetProperty("OutputType");
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@
|
|||||||
|
|
||||||
var solutionModel = await VsPersistenceMapper.GetSolutionModel(_solutionFilePath);
|
var solutionModel = await VsPersistenceMapper.GetSolutionModel(_solutionFilePath);
|
||||||
_solutionModel = solutionModel;
|
_solutionModel = solutionModel;
|
||||||
await RoslynTest.Analyse(_solutionFilePath);
|
await RoslynAnalysis.Analyse(_solutionFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CancellationTokenSource? _cancellationTokenSource = null!;
|
private CancellationTokenSource? _cancellationTokenSource = null!;
|
||||||
|
|||||||
Reference in New Issue
Block a user