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

Debugging aspected code without extra effort #384

Open
ekmedinet opened this issue Nov 26, 2024 · 4 comments
Open

Debugging aspected code without extra effort #384

ekmedinet opened this issue Nov 26, 2024 · 4 comments

Comments

@ekmedinet
Copy link

When we try to debug a method that has aspects, debugger behaves strangely seemingly not in sync with its binary.

After trying the recommendation in this link we can debug, but it seems like a hassle if we don't need to debug the actual aspects.

Is there a way to enable default debugging behavior, so that we don't need to use LamaDebug configuration and debug through aspect code to get to the code we are interested in?

Thanks!

@addabis
Copy link
Member

addabis commented Nov 26, 2024

Hello,

LamaDebug, among other things, sets the MetalamaDebugTransformedCode property to True, which enables the debugging.

So, if you create Directory.Build.props that looks like the following, you should get the behavior you want:

<?xml version="1.0" encoding="utf-8" ?>
<Project>
    <PropertyGroup>
        <MetalamaDebugTransformedCode Condition="$(Configuration) == 'Debug'">True</MetalamaDebugTransformedCode>
    </PropertyGroup>
</Project>

However, note that this would also automatically format the output code, which results in worse build performance for all Debug builds.

@ekmedinet
Copy link
Author

Thank you for response @addabis , your solution helps in a way that we don't have to create separate LamaDebug configuration.

The drawback however is that we still see aspect code and have to debug through it (though 99 percent of time we are not interested in that).

So it is not possible to debug only our custom code like we were able with PostSharp?

@gfraiteur
Copy link
Member

If there is a defect in debugging behavior, it would be best to record a video demonstrating the issue and give the code of the aspect that causes it.

@ekmedinet
Copy link
Author

@gfraiteur, I thought this was expected behavior. When not using LamaDebug configuration it looks like debug pointer is following hidden aspect code, jumping around custom code. Similar to when binary being debugged is not in sync with source code.

I will try to prepare test project shortly.

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

3 participants