question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor specific libraries size-reduction tracking

See original GitHub issue

Source generators can be used to convert code that does reflection.emit at runtime to source generators which will create code at build time rather than runtime. The generated code can then be analyzed by the illinker or native AOT enabling those scenarios. Blazor doesn’t use Reflection.Emit directly (though it may use it via dependency injection libraries). However Blazor does use reflection extensively, in the following areas:

  • Routing (Router.cs, RouteTableFactory.cs), to walk the set of exported assembly types to find those with RouteAttribute
  • Component factory (ComponentFactory.cs), to discover the properties with InjectAttribute, which we later populate via DI
  • Parameter assigmment (ComponentProperties.cs, MemberAssignment.cs, CascadingParameterState.cs, PropertySetter.cs), to find the properties on a type with ParameterAttribute and to write supplied values to them #29550
  • Layouts (LayoutView.cs, RouteView.cs), to discover the LayoutAttribute on a component
  • Data binding (InputBase.cs), because components declare their bound ValueExpression as an Expression<Func<TValue>> so that the validation system can match it to a FieldIdentifier
  • Validation (FieldIdentifier.cs, EditContextDataAnnotationsExtensions.cs), to know to convert lambda expressions to FieldIdentifier instances (type+propertyname pairs), and to read values of properties matching FieldIdentifier entries in the EditContext, so it can pass those values to DataAnnotations for validation
  • WebAssembly startup (EntrypointInvoker.cs), to find and invoke the assembly entrypoint method #30600
  • Lazy loading (LazyAssemblyLoader.cs), to load assemblies dynamically via Assembly.Load(filenameString)
  • WebAssembly auth (WebAssemblyAuthenticationServiceCollectionExtensions.cs), to generate an “inferred client ID” via Assembly.GetCallingAssembly().GetName().Name
  • <component> tag helper (RootComponentTypeCache.cs, ComponentParametersTypeCache.cs), to look up the type instances corresponding to serialized descriptors of components being rendered into HTML markers
  • BlazorPack (SequenceOfT.cs), to check whether a type is a value type via typeof(T).GetTypeInfo().IsValueType

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
mkArtakMSFTcommented, Apr 21, 2021

Marked this as cut. We may do some of these items, but can’t commit.

0reactions
msftbot[bot]commented, Nov 18, 2020

Thanks for contacting us. We’re moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core Blazor performance best practices
NET Core Blazor apps and avoiding common performance problems. ... track information for the next potential component update.
Read more >
10 Blazor Features You Probably Didn't Know
Blazor is a cutting-edge framework for web development with .NET. In this blog, we'll explain the most important features you need to know ......
Read more >
Top 10 Blazor Features You Probably Didn't Know
As a relatively new framework, there's probably a lot you don't know about Blazor yet. Here are 10 great features about Blazor you...
Read more >
Pros and Cons of Using JavaScript Interop in Blazor
This blog post explains using JavaScript interop concepts in the Blazor framework, its advantages, and its limitations with code examples.
Read more >
Blazor Internals you need to know
Understand Blazor internals to get started with Blazor. Learn about Blazor WebAssembly and Server differences and choose the right mode.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found