fable-compiler/Fable

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

Open

#3 511 ouverte le 22 août 2023

Voir sur GitHub
 (6 commentaires) (0 réactions) (0 assignés)F# (323 forks)github user discovery
bughelp wanted

Métriques du dépôt

Stars
 (3 087 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

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.

Guide contributeur