Skip to content

AOT with Reflection #95244

Answered by vitek-karas
dotnetcadet asked this question in Q&A
Nov 26, 2023 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

It's actually not true that generic parameters are always known at compile time. Code can call for example typeof(List<>).MakeGenericType(Console.ReadLine()) in which case the generic parameter is not known statically. But also, early on we decided against doing automatic propagation of types across method boundaries because if there are problems which would need to be reported to the user, the experience around it can be really bad (if you ever worked with templates in C++, you are probably familiar with the really complex errors you can get from the compiler, this would be similar and some cases even worse).

For this (and other reasons) the tooling requires you to annotate the types (ei…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@vitek-karas
Comment options

Comment options

You must be logged in to vote
4 replies
@dotnetcadet
Comment options

@davidfowl
Comment options

@dotnetcadet
Comment options

@vitek-karas
Comment options

Answer selected by dotnetcadet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants