fable-compiler/Fable

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

Aberta

#3.511 aberto em 22 de ago. de 2023

 (6 comentários) (0 reação) (0 responsável)F# (327 forks)github user discovery
bughelp wanted

Métricas do repositório

Stars
 (3.144 estrelas)
Métricas de merge de PR
 (Mesclagem média 1d 1h) (122 fundiu PRs em 30d)

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.

Guia do colaborador