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

Module.ScopeName returns appname.dll for single-file apps #56519

Closed
agocke opened this issue Jul 29, 2021 · 6 comments
Closed

Module.ScopeName returns appname.dll for single-file apps #56519

agocke opened this issue Jul 29, 2021 · 6 comments

Comments

@agocke
Copy link
Member

agocke commented Jul 29, 2021

When published as a single file, this code prints single-file.dll.

class Program
{
    public static void Main()
    {
         Console.WriteLine(typeof(Program).Assembly.GetModules()[0].ScopeName);
    }
}

It's unclear whether this is the correct behavior or just an oversight. Name and FullyQualifiedName both return <Unknown>

@dotnet-issue-labeler dotnet-issue-labeler bot added area-Single-File untriaged New issue has not been triaged by the area owner labels Jul 29, 2021
@ghost
Copy link

ghost commented Jul 29, 2021

Tagging subscribers to this area: @agocke, @vitek-karas, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

When published as a single file, this code prints single-file.dll.

class Program
{
    public static void Main()
    {
         Console.WriteLine(typeof(Program).Assembly.GetModules()[0].ScopeName);
    }
}

It's unclear whether this is the correct behavior or just an oversight. Name and FullyQualifiedName both return <Unknown>

Author: agocke
Assignees: -
Labels:

area-Single-File, untriaged

Milestone: -

@agocke agocke removed the untriaged New issue has not been triaged by the area owner label Jul 29, 2021
@agocke agocke added this to the 6.0.0 milestone Jul 29, 2021
@jkotas
Copy link
Member

jkotas commented Jul 29, 2021

I think it is the correct behavior. ScopeName is meant to return the scope name from metadata, with no sugar coating.

@agocke
Copy link
Member Author

agocke commented Jul 29, 2021

Is .dll appropriate? That was the strange part for me.

@agocke
Copy link
Member Author

agocke commented Jul 29, 2021

If we do not end up changing this behavior, I think the behavior change should maybe be on MetadataLoadContext (at the suppression in #56196) to produce a string different from <Unknown> when loading from memory

@jkotas
Copy link
Member

jkotas commented Jul 30, 2021

I think the behavior change should maybe be on MetadataLoadContext

Agree. ScopeName should return ModuleDefinition.Name

Is .dll appropriate?

Roslyn uses the filename, including the suffix, for this by default. You can override the default using /modulename Roslyn switch. E.g. Compile .dll with /modulename:banana - ScopeName will return banana without .dll suffix.

@agocke agocke modified the milestones: 6.0.0, 7.0.0 Aug 16, 2021
@agocke agocke modified the milestones: 7.0.0, 8.0.0 Jul 28, 2022
@agocke agocke modified the milestones: 8.0.0, 9.0.0 Sep 18, 2023
@agocke
Copy link
Member Author

agocke commented Aug 2, 2024

I'm going to close this as by-design. Changing these values now seems like low value without a motivating scenario.

@agocke agocke closed this as completed Aug 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

2 participants