Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get more logs out of msbuild #189

Merged
merged 1 commit into from Apr 1, 2023
Merged

Get more logs out of msbuild #189

merged 1 commit into from Apr 1, 2023

Conversation

TheAngryByrd
Copy link
Member

@TheAngryByrd TheAngryByrd commented Mar 30, 2023

WHAT

🤖 Generated by Copilot at 9274475

This pull request introduces a new logger for MSBuild events using LogProvider and enhances the error reporting with more detailed messages. It affects the Library.fs file in the Ionide.ProjInfo project.

🤖 Generated by Copilot at 9274475

Sing, O Muse, of the skillful coder who devised
A new logger, using the LogProvider library,
To capture the events of MSBuild, the mighty tool
That shapes the projects of mortals with its power.

📝🛠️🚀

WHY

We were missing log output failure reasons on the Graph path. Additionally we can now log more output. This should help narrow down why project loads fail for people.

Log output
[18:44:19.266 INF] [Ionide.ProjInfo.WorkspaceLoaderViaProjectGraph] Started loading projects 18 ["c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\src\\Compiler\\FSharp.Compiler.Service.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\src\\fsc\\fscProject\\fsc.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\src\\FSharp.Core\\FSharp.Core.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\src\\FSharp.DependencyManager.Nuget\\FSharp.DependencyManager.Nuget.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\benchmarks\\FCSBenchmarks\\BenchmarkComparison\\HistoricalBenchmark.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\src\\fsi\\fsiProject\\fsi.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\benchmarks\\FCSBenchmarks\\CompilerServiceBenchmarks\\FSharp.Compiler.Benchmarks.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\src\\FSharp.Compiler.Interactive.Settings\\FSharp.Compiler.Interactive.Settings.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\buildtools\\fsyacc\\fsyacc.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\buildtools\\AssemblyCheck\\AssemblyCheck.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\benchmarks\\FCSBenchmarks\\BenchmarkComparison\\HistoricalBenchmark.Runner\\HistoricalBenchmark.Runner.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\buildtools\\fslex\\fslex.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\FSharp.Compiler.ComponentTests\\FSharp.Compiler.ComponentTests.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\service\\data\\CSharp_Analysis\\CSharp_Analysis.csproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\src\\FSharp.Build\\FSharp.Build.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\FSharp.Compiler.Service.Tests\\FSharp.Compiler.Service.Tests.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\FSharp.Test.Utilities\\FSharp.Test.Utilities.fsproj", "c:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\fsharp\\tests\\service\\data\\TestTP\\TestTP.fsproj"]
[18:44:19.292 INF] [MsBuild] Build started.
[18:44:19.303 DBG] [MsBuild] Static graph loaded in 0.544 seconds: 26 nodes, 50 edges
[18:44:19.461 DBG] [MsBuild] net session >nul 2>&1
[18:44:19.504 ERR] [MsBuild] The specified task executable location "C:\Program Files\dotnet\sdk\7.0.202\FSharp\fsc.exe" is invalid.
[18:44:20.890 DBG] [MsBuild] net session >nul 2>&1
[18:44:20.897 ERR] [MsBuild] The specified task executable location "C:\Program Files\dotnet\sdk\7.0.202\FSharp\fsc.exe" is invalid.
[18:44:21.497 DBG] [MsBuild] net session >nul 2>&1
[18:44:21.498 ERR] [MsBuild] The specified task executable location "C:\Program Files\dotnet\sdk\7.0.202\FSharp\fsc.exe" is invalid.

HOW

🤖 Generated by Copilot at 9274475

  • Introduce a new logging function msBuildToLogProvider that uses the LogProvider library to log MSBuild events with different levels and context (link)
  • Rename the existing logging function logger to stringWriterLogger to avoid confusion (link)
  • Create two logger instances, one using stringWriterLogger and one using msBuildToLogProvider, and pass them to the createLoggers function (link)
  • Modify the createLoggers function to return both logger instances when the binaryLogs parameter is Off or Within dir (link, link)
  • Add a parameter msbuildErrors to the handleError function that takes a string containing the MSBuild messages from the StringWriter instance (link)
  • Assign the MSBuild messages from the StringWriter instance to a local variable msbuildMessage after the BuildManager finishes building the projects (link)
  • Pass the msbuildMessage variable to the handleError function when the result indicates a failure (link)
  • Modify the logging logic to use different levels and interpolation depending on the result.OverallResult value and include the msbuildMessage variable in the error log when the result is not Success (link)
  • Pass an empty string as the msbuildErrors parameter to the handleError function when an exception is thrown outside the BuildManager scope (link)

@TheAngryByrd TheAngryByrd merged commit 22b59a7 into main Apr 1, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant