fable-compiler/Fable

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

Open

#3511 aperta il 22 ago 2023

Vedi su GitHub
 (6 commenti) (0 reazioni) (0 assegnatari)F# (323 fork)github user discovery
bughelp wanted

Metriche repository

Star
 (3087 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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.

Guida contributor