|
1 | 1 |
|
2 | 2 | #mono-linker-issue |
3 | | -Open the Client `.csproj` file and ensure that the following switch is present. At the moment the IL Linker needs to be disabled because of [an issue in Mono](https://github.com/mono/mono/issues/12917) that is not yet merged into the Blazor framework. |
| 3 | +Add a `Linker.xml` file to the `Client` project with the following content (make sure to use your actual app name at the end): |
4 | 4 |
|
5 | | - **.csproj** |
| 5 | + **Linker.xml** |
6 | 6 |
|
7 | | - <PropertyGroup> |
8 | | - <!-- there may be other elements here --> |
9 | | - <BlazorLinkOnBuild>false</BlazorLinkOnBuild> |
10 | | - </PropertyGroup> |
| 7 | + <?xml version="1.0" encoding="UTF-8" ?> |
| 8 | + <!-- |
| 9 | + This file specifies which parts of the BCL or Blazor packages must not be |
| 10 | + stripped by the IL Linker even if they aren't referenced by user code. |
| 11 | + --> |
| 12 | + <linker> |
| 13 | + <assembly fullname="mscorlib"> |
| 14 | + <!-- |
| 15 | + Preserve the methods in WasmRuntime because its methods are called by |
| 16 | + JavaScript client-side code to implement timers. |
| 17 | + Fixes: https://github.com/aspnet/Blazor/issues/239 |
| 18 | + --> |
| 19 | + <type fullname="System.Threading.WasmRuntime" /> |
| 20 | + </assembly> |
| 21 | + <assembly fullname="System.Core"> |
| 22 | + <!-- |
| 23 | + System.Linq.Expressions* is required by Json.NET and any |
| 24 | + expression.Compile caller. The assembly isn't stripped. |
| 25 | + --> |
| 26 | + <type fullname="System.Linq.Expressions*" /> |
| 27 | + <type fullname="System.Linq.Queryable*" /> |
| 28 | + <type fullname="System.Linq.Enumerable*" /> |
| 29 | + <type fullname="System.Linq.EnumerableRewriter*" /> |
| 30 | + </assembly> |
| 31 | + <!-- |
| 32 | + In this example, the app's entry point assembly is listed. The assembly |
| 33 | + isn't stripped by the IL Linker. |
| 34 | + --> |
| 35 | + <assembly fullname="ClientBlazorApp.Client" /> |
| 36 | + </linker> |
| 37 | + |
| 38 | +#end |
| 39 | + |
| 40 | +#more-on-linker |
| 41 | +You can read more about configuring the linker in MSDN: [https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/blazor/configure-linker?view=aspnetcore-3.0#control-linking-with-a-configuration-file](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/blazor/configure-linker?view=aspnetcore-3.0#control-linking-with-a-configuration-file). |
| 42 | + |
| 43 | +>caution Without such a linker configuration, the linker strips aggressively extension methods and this breaks our components. |
11 | 44 | #end |
12 | 45 |
|
13 | 46 |
|
|
0 commit comments