diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 02696c53f0e..470c345f70e 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -2148,6 +2148,7 @@ and typeDefReader ctxtH : ILTypeDefStored = ctxt.fileName.EndsWith("System.Runtime.dll") || ctxt.fileName.EndsWith("mscorlib.dll") || ctxt.fileName.EndsWith("netstandard.dll") + || ctxt.fileName.EndsWith("System.Private.CoreLib.dll") while attrIdx <= attrsEndIdx && not containsExtensionMethods do let mutable addr = ctxt.rowAddr TableNames.CustomAttribute attrIdx diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index a8739d93390..f7587333981 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -352,6 +352,22 @@ tInput.Length let value = opt.Value Assert.Equal(4L, downcast value.ReflectionValue) + [] // usessdkrefs is not a valid option for desktop compiler + member _.``ML - use assembly with ref dependencies and without refing SMemory``() = + let code = """ +#r "nuget:Microsoft.ML.OnnxTransformer,1.4.0" + +open System +open System.Numerics.Tensors +let inputValues = [| 12.0; 10.0; 17.0; 5.0 |] +let tInput = new DenseTensor(inputValues.AsMemory(), new ReadOnlySpan([|4|])) +tInput.Length +""" + use script = new FSharpScript(additionalArgs=[| "/usesdkrefs-" |]) + let opt = script.Eval(code) |> getValue + let value = opt.Value + Assert.Equal(4L, downcast value.ReflectionValue) + [] member _.``System.Device.Gpio - Ensure we reference the runtime version of the assembly``() = let code = """