fable-compiler/Fable

Investigate why having `Microsoft.NET.Test.Sdk` as a dependency throw exceptions while scanning for Fable plugins

Open

#3.511 geöffnet am 22. Aug. 2023

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)F# (323 Forks)github user discovery
bughelp wanted

Repository-Metriken

Stars
 (3.087 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Description

While working on #3441 (via commit https://github.com/fable-compiler/Fable/commit/d212c2f21ae5043a4b386ed496ad5fa0776a89d6) a regression has been introduced.

Indeed, when trying to compile Python and Rust tests projects, an error was reported:

Unhandled exception. FSharp.Compiler.DiagnosticsLogger+ReportedError: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'NeutralResourcesLanguageAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Resources.ResourceManager, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.)

This error is caused by the lines:

let scanForPlugins =
	asm.Contents.Attributes |> Seq.exists (fun attr ->
    	attr.AttributeType.TryFullName = Some "Fable.ScanForPluginsAttribute")

Which to me is not obvious why these lines would report an error. To fix this issue I decided to mimic the old behaviour of Fable which consist of ignoring exceptions at this place 🤫

I am opening this issue to keep track of this behaviour and if someone has an idea on why or how we can improve the situation please don't hesitate to step in.

I tried believe this problem only occur if the project has Microsoft.NET.Test.Sdk in its dependencies. So perhaps we could be a bit more restrictive on the DLL we skip.

Contributor Guide