forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLazyLoadingTest.cs
More file actions
21 lines (19 loc) · 862 Bytes
/
LazyLoadingTest.cs
File metadata and controls
21 lines (19 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Library;
using System;
using System.Text.Json;
using System.Runtime.InteropServices.JavaScript;
using System.Diagnostics.CodeAnalysis;
public partial class LazyLoadingTest
{
[JSExport]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, "LazyLibrary.Foo", "LazyLibrary")]
public static void Run()
{
// System.Text.Json is marked as lazy loaded in the csproj ("BlazorWebAssemblyLazyLoad"), this method can be called only after the assembly is lazy loaded
// In the test case it is done in the JS before call to this method
var text = JsonSerializer.Serialize(new Person("John", "Doe"), PersonJsonSerializerContext.Default.Person);
TestOutput.WriteLine(text);
}
}