-
Notifications
You must be signed in to change notification settings - Fork 832
Closed
Labels
Area-LangService-CodeFixesCode fixes associated with diagnosticsCode fixes associated with diagnosticsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
This working code triggers:
FS0760: It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type(args)', rather than 'Type(args)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value
open System.Media
open System.IO
let s = [|1uy; 2uy|]
let sp = new SoundPlayer(MemoryStream s)
sp.PlaySync()
After applying suggested change in Visual Studio the result is:
open System.Media
open System.IO
let s = [|1uy; 2uy|]
let sp = new SoundPlayer(new MemoryStream s)
sp.PlaySync()
This code is broken and gives compile error:
error FS0010: Unexpected symbol ')' in expression
The relevant source is here:
CodeFix/AddNewKeywordToDisposableConstructorInvocation.fs
Microsoft Visual Studio Community 2017
Version 15.9.10
VisualStudio.15.Release/15.9.10+28307.557
Microsoft .NET Framework
Version 4.7.03190

Metadata
Metadata
Assignees
Labels
Area-LangService-CodeFixesCode fixes associated with diagnosticsCode fixes associated with diagnosticsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
New