Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for dynamic keyword #16283

Closed
kai-oswald opened this issue Mar 29, 2018 · 5 comments
Closed

support for dynamic keyword #16283

kai-oswald opened this issue Mar 29, 2018 · 5 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@kai-oswald
Copy link

I recently tried using blazor with the dynamic keyword. The compilation is succesful, but the page stays empty. Is support for dynamic planned or am I missing something and there is a workaround to use dynamic?

@SteveSandersonMS
Copy link
Member

It did work ok when I tried it. Could you post a code sample that reproduces the issue? Thanks!

@kai-oswald
Copy link
Author

The following steps will reproduce the issue:

  • Create new Blazor Project
  • Add Microsoft.CSharp Nuget
  • Add Razor View:
@page "/dynamic"

<h2>@test</h2>

@functions {
    dynamic test = "this won't show";
}

@Suchiman
Copy link
Contributor

Suchiman commented Mar 30, 2018

@kai-oswald it does work, but it seems you missed the compiler error
obj\Debug\netstandard2.0\Pages\Index.g.cs(36,13,36,20): error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

Just add these to the blazor csproj to fix it:

    <PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
    <PackageReference Include="Microsoft.CSharp" Version="4.4.1" />

EDIT: But it seems i'm unable to read. You did add the Nuget... i needed to add both to make the compiler error go away, but after that, this just worked fine.

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Apr 5, 2018

After adding the two package (System.Dynamic.Runtime and Microsoft.CSharp), the code works fine with linking disabled (<BlazorLinkOnBuild>false</BlazorLinkOnBuild> in the csproj), but fails to compile if linking is enabled. The error is:

Cannot find declaration of exported type 'System.Threading.Semaphore' from the assembly 'System.Threading, Version=4.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Cannot find declaration of exported type 'System.Reflection.Emit.DynamicMethod' from the assembly 'System.Reflection.Emit.Lightweight, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Therefore I'll close this as a duplicate of aspnet/Blazor#365.

@danroth27
Copy link
Member

@SteveSandersonMS Did you link to the correct bug? How is this related to the Windows Defender issue?

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/blazor Oct 27, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Oct 27, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

5 participants