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 working code triggers:
After applying suggested change in Visual Studio the result is:
This code is broken and gives compile error:
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