P
P
Popou2022-01-28 17:19:15
ASP.NET
Popou, 2022-01-28 17:19:15

Why so much reflection?

I just started learning Asp.Net Core. Too much reflection, what happens to her? Is it cached into delegates before calling WebApp.Run() ? Or disappears during compilation (well, as in a unit, where part of the reflection disappears after compilation)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2022-01-28
@Popou

Yes, everything is cached and you can see it in the sources.
The solution is to make it more convenient for the developer.
Some things can be done on source generators.
Some others - do without reflection at all (for example, use MapGet / MapPost instead of controllers)
In fact, problems from reflection can arise only in two cases:
1. When you have some kind of extreme load and there is no caching (or it's a cold start, and nothing in the cache)
2. When you use Assembly Trimming
PS: Why "too much" in your opinion? What exactly, what is implemented on reflection, can be implemented without it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question