Inline functions might not be recompiled properly
See original GitHub issueApologies if this has been reported before, I couldn’t find it in other issues.
Changing strings in inline functions don’t seem to always be recompiled. Other changes does get recompiled.
Repro steps
Create solution with a console app and a class library:
open lib
Say.hello "there"
namespace lib
module Say =
let inline hello name =
printfn "Hello %s" name
Changes to the string in hello
don’t apply when doing a dotnet run
on the console app.
Expected behavior
Class library to be recompiled.
Actual behavior
~/dev/playground/InlineBug/console
λ dotnet run
Hello there
~/dev/playground/InlineBug/console
λ /bin/cat ../lib/Library.fs
namespace lib
module Say =
let inline hello name =
printfn "Bye %s" name
~/dev/playground/InlineBug/console
λ dotnet run
Hello there
Known workarounds
Doing a dotnet clean
before dotnet run
works.
Related information
Provide any related information (optional):
Operating system:
λ sw_vers
ProductName: macOS
ProductVersion: 13.4.1
BuildVersion: 22F82
.NET SDK version:
7.0.306
Issue Analytics
- State:
- Created 2 months ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
c++ - inline functions returning incorrect results
No, inlined functions are (of course) required to have the same results as non-inlined functions. So, the problem must be somewhere else, in...
Read more >"inline" functions are being wrongly eliminated · Issue #6144
I noticed the below issue using emscrption 1.37.29 (Win10, 64-bit portable version, fetched from here: https://github.com/juj/emsdk).
Read more >Inline Functions, C++ FAQ
Do inline functions improve performance? ¶ Δ ... Yes and no. Sometimes. Maybe. There are no simple answers. inline functions might make the...
Read more >Inline Functions in C++
Does C++ compiler create default constructor when we write our own? ... Why C++ is partially Object Oriented Language? ... C++ Function Overloading....
Read more >Recompile inline function
Hello,. I'm having a problem with a inline table function : CREATE FUNCTION dbo.udf_func (@id int). RETURNS TABLE AS RETURN (. SELECT v....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great work, fantastic! I’m glad to hear it’s already been fixed, and I’ll be looking forward to it being released in net8. And thanks a bunch for the workaround as well.
Repro works on my end as well, not related to macOS.
Does not matter weather the function is
inline
or notRepros both net7 as well net8
It does get fixed when I add the
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
item to lib’s .fsproj!Independently, it also does get fixed when I add the
-c Release
switch to dotnet runWhen I add the
-c Debug
, it does not update=> It is a combination of ProduceReferenceAssembly=true and Configuration=Debug (fsc.exe is then called with
--optimize-
)What I also tested:
dotnet run
:dotnet run
dotnet run -c Debug
dotnet run -c Release
=> A workaround for now is to use
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
. The next update of the net8 sdk will also include the change which fixes this behavior.