dotnet/runtime

Extra calls in Asm

Open

#109,688 创建于 2024年11月10日

在 GitHub 查看
 (8 评论) (0 反应) (0 负责人)C# (5,445 fork)batch import
area-CodeGen-coreclrhelp wanted

仓库指标

Star
 (17,886 star)
PR 合并指标
 (平均合并 12天 11小时) (30 天内合并 661 个 PR)

描述

Description

I have method

    public static void RecordError(Exception exception)
    {
    }

And I have code witch call RecordError

                try
                {
                     ...
                }
                catch (Exception ex)
                {
                    O.RecordError(ex);
                }

But when I build it and check Asm, I see call [Test.O:RecordError(System.Exception)] in asm

Since the method does not contain any code, its call could be removed.

I use .net 8 and Disasmo for see asm

Reproduction Steps

See Description

Expected behavior

not call method

Actual behavior

call method

Regression?

No response

Known Workarounds

Configuration

.net 8

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
</PropertyGroup>

Other information

No response

贡献者指南