You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
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
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.
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.
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:
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).
Activity
jkotas commentedon Apr 14, 2016
There is not one, but it would be nice to add it.
MichalStrehovsky commentedon Apr 15, 2016
On a first thought, making a new subclass of
CompilationModuleGroupmight 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 methodNametypeNameis in the ECMA 335 SerString format (we have a parser for that (GetTypeByCustomAttributeTypeName),methodNameis just the method nameThen it has two optional arguments:
-singlemethodgenericparam typeNameSpecifies 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 typeNameSpecifies parameter type (can occur multiple times). This is optional and only used when it's necessary to disambiguate between overloads.
manu-st commentedon Apr 18, 2016
@MichalStrehovsky Thanks for providing the hints. I'll see if I can make this work as this would be very useful to have.
manu-st commentedon Apr 18, 2016
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:
?
jkotas commentedon Apr 18, 2016
https://github.com/dotnet/corefxlab/tree/master/src/System.CommandLine
MichalStrehovsky commentedon Apr 18, 2016
CompilationModuleGroup is the thing that controls the dependency graph expansion. I would be wary of creating a new mechanism.
Right now the concrete
CompilationModuleGroupto be used during compilation is getting created inCompilation.cs, but we will likely want to have it created in the ILCompiler exe project and passed toCompilation(which means none of ILCompiler.Compiler will not need to know anything about the new switch, or the MultiModule switch for that matter).If it's a problem, it's reasonable to use different switches (or we could extend System.CommandLine to support it if needed).
Add support for single method compilation mode
Add support for single method compilation mode (#1516)