Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Is there an easy way to just compile a specific type or method of an assembly? #1142

Closed

Description

@manu-st

Is there a way to just generate the code for a specific type or method without generating any dependencies? This would help in debugging code generation issue.

Activity

  1. jkotas commented on Apr 14, 2016

    @jkotas
    Member

    There is not one, but it would be nice to add it.

  2. MichalStrehovsky commented on Apr 15, 2016

    @MichalStrehovsky
    Member

    On a first thought, making a new subclass of CompilationModuleGroup might be the way to go.

    The Project N native compiler exposes this functionality under following command line switches (we might want to align):

    • -singlemethodbyname typeName methodName

    typeName is in the ECMA 335 SerString format (we have a parser for that (GetTypeByCustomAttributeTypeName), methodName is just the method name

    Then it has two optional arguments:

    • -singlemethodgenericparam typeName

    Specifies a generic parameter [sic] to the method if the method is generic (can occur multiple times). I wouldn't mind if we name this singlemethodgeneric_arg_.

    • -singleMethodParam typeName

    Specifies parameter type (can occur multiple times). This is optional and only used when it's necessary to disambiguate between overloads.

  3. manu-st commented on Apr 18, 2016

    @manu-st
    Author

    @MichalStrehovsky Thanks for providing the hints. I'll see if I can make this work as this would be very useful to have.

  4. manu-st commented on Apr 18, 2016

    @manu-st
    Author

    Looking into this more, I'm not sure creating a new CompilationModuleGroup buys us much. It seems that the dependency analyzer might be the one we want to filter on since the code generation is actually done during the analysis. Any thoughts?

    As a side note, where is the System.CommandLine assembly coming from? I'm not sure if it will easily accept what you suggested as I could not figure out what its capabilities. By the way, could you confirm that the command line you suggested is following this specification:

    -singlemethodbyname typeName methodName [-singlemethodgenericarg typeName]* [-singlemethodeparam typeName]*
    

    ?

  5. jkotas commented on Apr 18, 2016

    @jkotas
    Member
  6. MichalStrehovsky commented on Apr 18, 2016

    @MichalStrehovsky
    Member

    Looking into this more, I'm not sure creating a new CompilationModuleGroup buys us much

    CompilationModuleGroup is the thing that controls the dependency graph expansion. I would be wary of creating a new mechanism.

    Right now the concrete CompilationModuleGroup to be used during compilation is getting created in Compilation.cs, but we will likely want to have it created in the ILCompiler exe project and passed to Compilation (which means none of ILCompiler.Compiler will not need to know anything about the new switch, or the MultiModule switch for that matter).

    I'm not sure if it will easily accept what you suggested as I could not figure out what its capabilities

    If it's a problem, it's reasonable to use different switches (or we could extend System.CommandLine to support it if needed).

  7. added a commit that references this issue on Jul 13, 2016
    f5f7611
  8. added a commit that references this issue on Jul 14, 2016
    39e5d69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions