Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra calls in Asm #10962

Closed
1zaboy opened this issue Nov 9, 2024 · 4 comments
Closed

Extra calls in Asm #10962

1zaboy opened this issue Nov 9, 2024 · 4 comments

Comments

@1zaboy
Copy link

1zaboy commented Nov 9, 2024

Issue 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)]

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

I use .net 8 and Disasmo for see asm

Steps to Reproduce

I have method

    public static void RecordError(Exception exception)
    {
    }

And I have code witch call RecordError

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

Expected Behavior

Not call method

Actual Behavior

call method

Analysis

No response

Versions & Configurations

.net 8

@baronfel
Copy link
Member

baronfel commented Nov 9, 2024

Hi - this issue doesn't seem related to MSBuild. Are you asking a question about how the C# compiler compiles your code?

@1zaboy
Copy link
Author

1zaboy commented Nov 9, 2024

@baronfel Hi, I think it's mistake of build of try catch block with Empty method. In asm Empty method should not to call.
Yea, maybe I write on wrong repo, but I don't shore who make final build.

@baronfel
Copy link
Member

baronfel commented Nov 9, 2024

It's ok. This repo is for the build tools/engine, but your question does seem to be about the C# compiler (which is a tool that we end up calling). I'll transfer you to the Roslyn repo so they can see your question.

@baronfel
Copy link
Member

baronfel commented Nov 9, 2024

Weird, I don't seem to have transfer permissions anymore. Can you recreate this at the dotnet/roslyn repo?

@baronfel baronfel closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants