OYIon / LiveSharp

Public repository for the LiveSharp project
96 stars 4 forks source link

1.6.25: "IL Compilation failed" If Run From IDE But Succeeds When Published #101

Closed warappa closed 3 years ago

warappa commented 3 years ago

Somehow IL compilation fails on property AssemblyString when run by IDE, but succeeds when published version is run by dotnet serve.

Workaround

Downgrade to LiveSharp 1.6.22 (don't forget to restart VS and rebuild solution).

Repo

https://github.com/warappa/RepoLiveSharpUpdateFailsWithMatBlazor/tree/dotnet5-debug-broken-publish-with-dotnet-serve-works

Prerequisites

Steps

  1. Clear %TEMP%\LiveSharp
  2. Start LiveSharp.Server (1.6.7)
  3. Checkout repo and open in VS 2019 (16.8.1 or 16.9.0 Preview 1)
  4. Publish Client project
  5. Navigate to published folder (RepoLiveSharpUpdateFailsWithMatBlazor\Client\bin\Debug\net5.0\browser-wasm\publish\wwwroot) and run dotnet serve -S -p 54328 - blazor app opens in browser
  6. Set Client project as startup project in IDE
  7. Run project (CTRL+F5) - blazor app opens in browser
  8. In Index.razor change <h1>Hello, world!</h1> to <h1>Hello, update!</h1>
  9. Update is reflected in browser of published version, but not in version started from the IDE - "IL Compilation failed" error is logged

Noteworthy

SignalR - working WebSocket communication (publish-dotnet-serve-run)

image

Payload

{"type":1,"target":"ServerMessage","arguments":["vu8CBQAAABQxAAAAH4sIAAAAAAAAAwtiSGVIBuJMhjIgmcKgwODMoAwkSxkKgLxEhhKgKADQq5evJAAAAJys"]}{"type":1,"target":"ServerMessage","arguments":["vu8CBQAAABRZAAAAH4sIAAAAAAAAAyWLywmAMBAFp5RUYBHevAYbEI0Y8EeIYvmOyPJ2mMduJDGazO2eCFyccqDqgZmDIjetsmjfTccuEw8NrR+ZVY82f1/oTXJet4SGQWAAAABJEw=="]}

SignalR - broken WebSocket communication (IDE-run)

image

Payload

{"type":1,"target":"ServerMessage","arguments":["vu8CBQAAABQxAAAAH4sIAAAAAAAAAwtiSGVIBuJMhjIgmcKgwODMoAwkSxkKgLxEhhKgKADQq5evJAAAAJys"]}{"type":1,"target":"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s56ZajxBXv8Lsd417Ho4r3h5+Jq7fXmw7KG67AfOZEacpsLlM2uD6AVjYvYqeDgAA4BM="]}

Output

Now listening on: http://127.0.0.1:61876
Application started. Press Ctrl+C to shut down.
11:59:01.018: Ended job: Dry run for RepoLiveSharpUpdateFailsWithMatBlazor.Client (3970)
11:59:10.395: Starting job: Handling Razor update: Pages\Index.razor
11:59:10.569: Updating obj\Debug\net5.0\Razor\Pages\Index.razor.g.cs
11:59:10.649: Ended job: Handling Razor update: Pages\Index.razor (251)
11:59:10.939: Received C# update
11:59:10.941: Received update for method Index.BuildRenderTree
11:59:10.943: error: IL Compilation failed:
<Method Name="BuildRenderTree" MethodIdentifier="RepoLiveSharpUpdateFailsWithMatBlazor.Client.Pages.Index BuildRenderTree Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder" DeclaringType="RepoLiveSharpUpdateFailsWithMatBlazor.Client.Pages.Index" DebugLevel="0" MaxStackSize="4" IsStatic="false" ReturnType="3" IsConstructor="false" IsPropertyMethod="false">
  <Parameters>
    <Parameter Name="__builder" Type="0" />
  </Parameters>
  <Members>
    <Member Token="167772199" ContainingType="0" Name="AddMarkupContent" ReturnType="3" MemberType="Method" ParameterTypes="1,2" />
    <Member Token="721420298" ContainingType="0" Name="OpenComponent" MemberType="Method" ReturnType="3" ParameterTypes="1" GenericArguments="4" />
    <Member Token="167772197" ContainingType="0" Name="AddAttribute" ReturnType="3" MemberType="Method" ParameterTypes="1,2,2" />
    <Member Token="167772194" ContainingType="0" Name="CloseComponent" ReturnType="3" MemberType="Method" ParameterTypes="" />
    <Member Token="167772196" ContainingType="0" Name="OpenElement" ReturnType="3" MemberType="Method" ParameterTypes="1,2" />
    <Member Token="100663322" ContainingType="5" Name="get_AssemblyString" ReturnType="2" MemberType="Method" ParameterTypes="" />
    <Member Token="167772198" ContainingType="0" Name="CloseElement" ReturnType="3" MemberType="Method" ParameterTypes="" />
  </Members>
  <Locals />
  <ExceptionHandlers />
  <Strings>
    <S Id="0">&lt;h1&gt;Hello, world!b&lt;/h1&gt;

Welcome to your new app.

</S>
    <S Id="1">Title</S>
    <S Id="2">How is Blazor working for you?</S>
    <S Id="3">

</S>
    <S Id="4">textarea</S>
    <S Id="5">value</S>
  </Strings>
  <IL>nop
ldarg.1
ldc.i4.0
ldstr s0
callvirt t167772199 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::AddMarkupContent(System.Int32,System.String)
nop
ldarg.1
ldc.i4.1
callvirt t721420298 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::OpenComponent&lt;RepoLiveSharpUpdateFailsWithMatBlazor.Client.Shared.SurveyPrompt&gt;(System.Int32)
nop
ldarg.1
ldc.i4.2
ldstr s1
ldstr s2
callvirt t167772197 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::AddAttribute(System.Int32,System.String,System.String)
nop
ldarg.1
callvirt t167772194 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::CloseComponent()
nop
ldarg.1
ldc.i4.3
ldstr s3
callvirt t167772199 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::AddMarkupContent(System.Int32,System.String)
nop
ldarg.1
ldc.i4.4
ldstr s4
callvirt t167772196 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::OpenElement(System.Int32,System.String)
nop
ldarg.1
ldc.i4.5
ldstr s5
ldarg.0
call t100663322 //System.String RepoLiveSharpUpdateFailsWithMatBlazor.Client.Pages.Index::get_AssemblyString()
callvirt t167772197 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::AddAttribute(System.Int32,System.String,System.String)
nop
ldarg.1
callvirt t167772198 //System.Void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder::CloseElement()
nop
ret</IL>
</Method>
System.AggregateException: Instruction compilation failed: 33: call System.String get_AssemblyString() (No coercion operator is defined between types 'LiveSharp.Runtime.Virtual.VirtualType0' and 'RepoLiveSharpUpdateFailsWithMatBlazor.Client.Pages.Index'.)
 ---> System.InvalidOperationException: No coercion operator is defined between types 'LiveSharp.Runtime.Virtual.VirtualType0' and 'RepoLiveSharpUpdateFailsWithMatBlazor.Client.Pages.Index'.
   at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
   at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method)
   at System.Linq.Expressions.Expression.Convert(Expression expression, Type type)
   at LiveSharp.Runtime.IL.CompilerHelpers.Coerce(Expression expr, Type targetType)
   at LiveSharp.Runtime.IL.IlExpressionCompilerHandlers.CallImpl(InstructionContext ctx, Boolean isVirtualCall)
   at LiveSharp.Runtime.IL.IlExpressionCompilerHandlers.Call(InstructionContext ctx)
   at LiveSharp.Runtime.IL.IlExpressionCompiler.CompileInstruction(InstructionContext instructionContext)
   --- End of inner exception stack trace ---
   at LiveSharp.Runtime.IL.IlExpressionCompiler.CompileInstruction(InstructionContext instructionContext)
   at LiveSharp.Runtime.IL.CompilerContext.Compile(IlInstruction instruction, ImmutableStack`1 stack)
   at LiveSharp.Runtime.IL.CompilerContext.CompileBranch(Int32 instructionIndex)
   at LiveSharp.Runtime.IL.CompilerContext.<CompileInstructions>g__compileBranch|36_0(Int32 index)
   at LiveSharp.Runtime.IL.CompilerContext.CompileInstructions()
   at LiveSharp.Runtime.IL.IlExpressionCompiler.GetDelegate(Boolean enableDebugging, Type delegateType)
   at LiveSharp.Runtime.IL.MethodMetadata.CreateDelegate(Type delegateType)
11:59:10.957: error: IlCompilationException: System.AggregateException: Instruction compilation failed: 33: call System.String get_AssemblyString() (No coercion operator is defined between types 'LiveSharp.Runtime.Virtual.VirtualType0' and 'RepoLiveSharpUpdateFailsWithMatBlazor.Client.Pages.Index'.)
 ---> System.InvalidOperationException: No coercion operator is defined between types 'LiveSharp.Runtime.Virtual.VirtualType0' and 'RepoLiveSharpUpdateFailsWithMatBlazor.Client.Pages.Index'.
   at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
   at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method)
   at System.Linq.Expressions.Expression.Convert(Expression expression, Type type)
   at LiveSharp.Runtime.IL.CompilerHelpers.Coerce(Expression expr, Type targetType)
   at LiveSharp.Runtime.IL.IlExpressionCompilerHandlers.CallImpl(InstructionContext ctx, Boolean isVirtualCall)
   at LiveSharp.Runtime.IL.IlExpressionCompilerHandlers.Call(InstructionContext ctx)
   at LiveSharp.Runtime.IL.IlExpressionCompiler.CompileInstruction(InstructionContext instructionContext)
   --- End of inner exception stack trace ---
   at LiveSharp.Runtime.IL.IlExpressionCompiler.CompileInstruction(InstructionContext instructionContext)
   at LiveSharp.Runtime.IL.CompilerContext.Compile(IlInstruction instruction, ImmutableStack`1 stack)
   at LiveSharp.Runtime.IL.CompilerContext.CompileBranch(Int32 instructionIndex)
   at LiveSharp.Runtime.IL.CompilerContext.<CompileInstructions>g__compileBranch|36_0(Int32 index)
   at LiveSharp.Runtime.IL.CompilerContext.CompileInstructions()
   at LiveSharp.Runtime.IL.IlExpressionCompiler.GetDelegate(Boolean enableDebugging, Type delegateType)
   at LiveSharp.Runtime.IL.MethodMetadata.CreateDelegate(Type delegateType)

dotnet --info

.NET SDK (gemäß "global.json"):
 Version:   5.0.100
 Commit:    5044b93829

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  1.1.0 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.802 [C:\Program Files\dotnet\sdk]
  2.2.105 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
warappa commented 3 years ago

Seems like this issue is releated to the Workspace\SolutionCache folder in the nuget package folder which was out of sync.

ionoy commented 3 years ago

Thank you for the detailed report! Can I assume that this issue was caused by stale SolutionCache then?

warappa commented 3 years ago

Hi @ionoy , I managed to retest it now. It is still reproduceable with this repo.

Steps:

On the start-page I print all loaded Assemblies. It should start the list with "Anonymous ..." assembly, but it doesn't. (In this repo the JSON corruption does not happen)

ionoy commented 3 years ago

Can you try this build, please? I still get warning: ReflectionTypeLoadException Microsoft.JSInterop.WebAssembly... but otherwise it updates fine with the steps you provided above.

LiveSharp.1.6.26.zip

warappa commented 3 years ago

@ionoy Strange, I upgraded to 1.6.26 but no difference... Same output, exception etc. in F5 mode, but works if Client project is published and run by dotnet-serve.

Observation with both versions: As soon as I don't see Anonymously Hosted DynamicMethods Assembly I know it doesn't work.

In the working case it has a subset of assemblies loaded compared to the non-working case, but 2 assemblies are missing in the non-working case: Anonymously Hosted DynamicMethods Assembly and System.Net.Http.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

This are the loaded assemblies when it's broken (F5 start):

LiveSharp, Version=1.6.2.0, Culture=neutral, PublicKeyToken=eb8d613aaa987ee9
LiveSharp.Interfaces, Version=1.6.2.0, Culture=neutral, PublicKeyToken=fe18a89f0002ab01
LiveSharp.Runtime, Version=1.6.2.0, Culture=neutral, PublicKeyToken=eb8d613aaa987ee9
LiveSharp.ServerClient, Version=1.6.2.0, Culture=neutral, PublicKeyToken=78203f1299fc2bef
LiveSharp.Support.BlazorWASM, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null
Microsoft.AspNetCore.Components, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Components.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Components.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Components.WebAssembly, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Connections.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Http.Connections.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Http.Connections.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Http.Features, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Client.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Protocols.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Configuration, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Configuration.FileExtensions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Configuration.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.DependencyInjection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.FileProviders.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.FileProviders.Physical, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.FileSystemGlobbing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.JSInterop, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.JSInterop.WebAssembly, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Win32.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
RepoLiveSharpUpdateFailsWithMatBlazor.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
RepoLiveSharpUpdateFailsWithMatBlazor.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Buffers, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Collections, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Collections.Concurrent, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Collections.Immutable, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Collections.NonGeneric, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Collections.Specialized, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ComponentModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ComponentModel.Annotations, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ComponentModel.EventBasedAsync, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ComponentModel.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ComponentModel.TypeConverter, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Console, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Data.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.Contracts, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.Debug, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.DiagnosticSource, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Diagnostics.FileVersionInfo, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.Process, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.StackTrace, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.TextWriterTraceListener, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.TraceSource, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.Tracing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Drawing.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Formats.Asn1, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.IO.Compression, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.IO.Compression.Brotli, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.IO.Compression.ZipFile, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.IO.FileSystem, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.FileSystem.DriveInfo, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.FileSystem.Watcher, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.IsolatedStorage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.MemoryMappedFiles, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.IO.Pipes, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Linq.Expressions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Linq.Parallel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Linq.Queryable, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Memory, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.HttpListener, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.Mail, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.NameResolution, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.NetworkInformation, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Ping, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Requests, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.ServicePoint, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.Sockets, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.WebClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.WebHeaderCollection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.WebProxy, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.WebSockets, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.WebSockets.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Numerics.Vectors, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
System.Private.DataContractSerialization, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Private.Runtime.InteropServices.JavaScript, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Private.Uri, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Private.Xml, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Private.Xml.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Reflection.DispatchProxy, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Reflection.Emit, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Reflection.Emit.ILGeneration, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Reflection.Emit.Lightweight, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Reflection.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Resources.ResourceManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Resources.Writer, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.CompilerServices.VisualC, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Extensions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.InteropServices, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.InteropServices.RuntimeInformation, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Intrinsics, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Runtime.Loader, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Numerics, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Serialization.Formatters, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Serialization.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Serialization.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Serialization.Xml, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Claims, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Cryptography.Algorithms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Cryptography.Csp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Cryptography.Encoding, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Cryptography.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Cryptography.X509Certificates, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Text.Encoding.Extensions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Text.Encodings.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Text.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Text.RegularExpressions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Threading, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Threading.Channels, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Threading.Overlapped, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Threading.Tasks, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Threading.Tasks.Parallel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Threading.Thread, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Threading.ThreadPool, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Transactions.Local, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Web.HttpUtility, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Xml.ReaderWriter, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Xml.XDocument, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Xml.XmlSerializer, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Xml.XPath, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Xml.XPath.XDocument, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

This are the assemblies when it's working (Client project publish + dotnet serve)

Anonymously Hosted DynamicMethods Assembly
LiveSharp, Version=1.6.2.0, Culture=neutral, PublicKeyToken=eb8d613aaa987ee9
LiveSharp.Interfaces, Version=1.6.2.0, Culture=neutral, PublicKeyToken=fe18a89f0002ab01
LiveSharp.Runtime, Version=1.6.2.0, Culture=neutral, PublicKeyToken=eb8d613aaa987ee9
LiveSharp.ServerClient, Version=1.6.2.0, Culture=neutral, PublicKeyToken=78203f1299fc2bef
LiveSharp.Support.BlazorWASM, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null
Microsoft.AspNetCore.Components, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Components.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Components.WebAssembly, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Connections.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Http.Connections.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Http.Connections.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.Http.Features, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Client.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.AspNetCore.SignalR.Protocols.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Configuration, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Configuration.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.DependencyInjection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.JSInterop, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.JSInterop.WebAssembly, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Microsoft.Win32.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
RepoLiveSharpUpdateFailsWithMatBlazor.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
RepoLiveSharpUpdateFailsWithMatBlazor.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
System.Collections, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Collections.Concurrent, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Collections.NonGeneric, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ComponentModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Console, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Diagnostics.TraceSource, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.Compression, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.IO.FileSystem, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Linq.Expressions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Memory, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Http.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Net.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Requests, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Sockets, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.WebSockets, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.WebSockets.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
System.Private.Runtime.InteropServices.JavaScript, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Private.Uri, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Private.Xml, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Private.Xml.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.InteropServices.RuntimeInformation, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Serialization.Formatters, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Cryptography.Algorithms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Security.Cryptography.X509Certificates, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Text.Encodings.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Text.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Text.RegularExpressions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Threading.Channels, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

EDIT

Wow. Trimming changes the LiveSharp dependencies to make it work. And: It switches the referenced assembly from netstandard to System.Private.CoreLib. image

Tested publishing without trimming (<PropertyGroup>...<PublishTrimmed>false</PublishTrimmed>...</PropertyGroup>) and it does not work, publish with trimming and it works!

warappa commented 3 years ago

Sidenote: In the working case the Anonymously Hosted DynamicMethods Assembly assembly is loaded and visible in the list, regardless if a connection to LiveSharp.Server is already established or not (read: LiveSharp.Server does not matter).

Something prevents the Anonymously Hosted DynamicMethods Assembly assembly from loading in the first place.

Wild guess: Maybe the LiveSharp assembly causing the creation of Anonymously Hosted DynamicMethods Assembly requires netstandard2.1 or even net5.0 as target to successfully load.

Note: As far as I found out the netstandard2.1 assembly is just a reference assembly which references another reference assembly (System.Reflection.Emit 5.0.0.0) which then references System.Private.CoreLib. And the (trimmed) versions of LiveSharp in the working published directory are transformed to reference System.Private.CoreLib directly and works. I'm not saying this is the cause, but it seems like an interesting correlation...

ionoy commented 3 years ago

When do you check for Anonymously Hosted DynamicMethods Assembly? I think it should be loaded when LiveSharp.Support.BlazorWASM creates interceptors for BuildRenderTree in BlazorUpdateHandler.Attach

Now I'm curious if 1) BlazorUpdateHandler was attached at all 2) OnMethodCallIntercepted was called with non-null Microsoft.AspNetCore.Components.ComponentBase (OnMethodCallIntercepted is implemented in LiveSharp.Runtime.dll LiveSharpRuntimeProxy if you want to dig deeper.

ionoy commented 3 years ago

By the way, are you using IIS Express in any of these tests?

warappa commented 3 years ago

When do you check for Anonymously Hosted DynamicMethods Assembly? I think it should be loaded when LiveSharp.Support.BlazorWASM creates interceptors for BuildRenderTree in BlazorUpdateHandler.Attach

Because I found: if it's there, it works ;) (As far as I understand it's where the Emit stuff ends up)

Now I'm curious if

  1. BlazorUpdateHandler was attached at all
  2. OnMethodCallIntercepted was called with non-null Microsoft.AspNetCore.Components.ComponentBase (OnMethodCallIntercepted is implemented in LiveSharp.Runtime.dll LiveSharpRuntimeProxy if you want to dig deeper.

How can I check that - in LiveSharp.dashboard.cs?

By the way, are you using IIS Express in any of these tests? I think I tried both, but will check that again.

warappa commented 3 years ago

Fixed in 1.6.30