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

#nowarn “2003” doesn't disable FS2003 #3139

Closed
curtnichols opened this issue May 26, 2017 · 4 comments
Closed

#nowarn “2003” doesn't disable FS2003 #3139

curtnichols opened this issue May 26, 2017 · 4 comments
Labels
Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@curtnichols
Copy link

The repro code, below, compiled in a fresh console project in VS2017 (v15.2), fails to suppress the FS2003 warning (which the #nowarn directive should suppress). I'm targeting F# 4.1 (FSharp.Core 4.4.1.0).

We compile with "warnings as errors," so this is a strong issue. This is to be used in generated code, so #nowarn is far preferable to editing every F# project.

Repro steps

Provide the steps required to reproduce the problem

  1. Create an F# console project with VS2017.

  2. Replace the program code with the code below.

  3. Build

    open System.Reflection

    #nowarn "2003"
    [<assembly: AssemblyInformationalVersion("13.3.1.74-g5224f3b")>]

    do() // necessary for the assembly attribute

    [<EntryPoint>]
    let main argv = 0

Expected behavior

No FS2003 warning should be generated.

Actual behavior

An FS2003 warning was generated.

FSC: warning FS2003: An System.Reflection.AssemblyInformationalVersionAttribute specified version '13.3.1.74-g5224f3b', but this value is invalid and has been ignored

Known workarounds

Hand edit all your VS F# projects to ignore the warning in the project properties page. (Ew.)

Related information

All testing was on .NET Framework 4.5 and 4.6.2 on Windows 10. Reproduces with both F# 4.0 and 4.1.

  • Problem reproduced on VS 2017 15.2 26430.4.
  • Problem reproduced on VS 2017 15.2 26430.6.
  • Problem reproduced on VS 2015 14.0.25431.01 Update 3.

Also brought up on https://stackoverflow.com/q/44187146/83202

@realvictorprm
Copy link
Contributor

@cartermp Any ideas?

@cartermp
Copy link
Contributor

cartermp commented Jun 3, 2017

I can repro, though I'm not sure what the root cause is here. I suspect it's a compiler issue, but I haven't debugged it.

@cartermp cartermp added the Bug label Jun 3, 2017
@cartermp cartermp added this to the VS 2017 Updates milestone Jun 3, 2017
@dsyme
Copy link
Contributor

dsyme commented Jun 5, 2017

Yeah, it's a compiler issue. The version information is checked before the scope pragma filters are in place

@dsyme dsyme added Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Area-Compiler labels Jun 5, 2017
@matthid
Copy link
Contributor

matthid commented Mar 10, 2018

Interestingly I cannot reproduce with the above code and a standalone fsc file.fs call. Instead it only reproduces when another version attribute is given:

Reproduces via fsc file.fs:

namespace System
open System.Reflection

#nowarn "2003"
[<assembly: AssemblyVersionAttribute("5.0.0")>]
[<assembly: AssemblyInformationalVersion("5.0.0-beta024")>]
do ()

Seems like AssemblyInformationalVersion has been whitelisted somewhere already but not properly.

matthid added a commit to matthid/visualfsharp that referenced this issue Mar 10, 2018
- Make sure the warning is triggered always (not only when AssemblyVersionAttribute is present)
- Make sure warning can be disabled via #nowarn 2003
- Include the correct range of the problematic string
KevinRansom pushed a commit that referenced this issue Apr 19, 2018
* Fix issue #3139,

- Make sure the warning is triggered always (not only when AssemblyVersionAttribute is present)
- Make sure warning can be disabled via #nowarn 2003
- Include the correct range of the problematic string

* add missing test-files.

* edit existing tests

* do not use full-qualified type name when reporting errors (as it was previously).

* use full name and wait for feedback

* Add comments as suggested.

* Change warning message slightly as suggested by @dsyme .

* Fix english localization.

* update test
@cartermp cartermp modified the milestones: VS 2017 Updates, 15.8 Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
None yet
Development

No branches or pull requests

5 participants