Postlagerkarte / blazor-dragdrop

Easy-to-use Drag and Drop Library for Blazor
MIT License
399 stars 96 forks source link

CS7000 Unexpected use of an aliased name #140

Open DoomerDGR8 opened 2 years ago

DoomerDGR8 commented 2 years ago

Hello!

Blazor Serverside App .Net 5.0 Using blazor drag-drop v2.3.0

I have the Dropzone on my razor as follows:

<Dropzone Id="ZoneApprovers" Items="@ApproverListData" TItem="ApproverTemplateDetailViewModel" OnItemDrop="ZoneApproversItemDropped" Context="zoneContext">
    <ApproverItem OnRemoveClick="itemRem => ApproverListData.Remove(itemRem)" Item="@zoneContext"/>
</Dropzone>

Where,

ApproverListData is:

protected IList<ApproverTemplateDetailViewModel> ApproverListData = new List<ApproverTemplateDetailViewModel>();

ApproverTemplateDetailViewModel is:

public class ApproverTemplateDetailViewModel
{
    public ApproverTemplateDetailViewModel()
    {

    }

    public ApproverTemplateDetailViewModel(ApproverTemplateDetail model)
    {
        TemplateId         = model.TemplateId;
        DetailId           = model.DetailId;
        ApproverResourceId = model.ApproverResourceId;
        ApproverName       = model.ApproverResource?.FullName;
        ApproverEmail      = model.ApproverResource?.EmailToUse;
        ApproverTypeId     = model.ApproverTypeId;
        ApproverTypeName   = model.ApproverType?.Name;
        ApprovalLevel      = model.ApprovalLevel;
    }

    public int?   TemplateId         { get; set; }
    public int    DetailId           { get; set; }
    public string ApproverResourceId { get; set; }
    public int    ApproverTypeId     { get; set; }
    public string ApproverTypeName   { get; set; }
    public string ApproverEmail      { get; set; }
    public string ApproverName       { get; set; }
    public byte   ApprovalLevel      { get; set; }
}

ApproverItem.razor is:

<div class="approverItemStyle">
    <DxButton Text="" RenderStyle="@ButtonRenderStyle.Secondary"  @onclick="@(()=> OnRemoveClick.InvokeAsync(Item))"
              RenderStyleMode="ButtonRenderStyleMode.Contained" SizeMode="SizeMode.Small" IconCssClass='@(Constants.FontAwesomeIconBasePrefix + "fa-trash-alt")'
              IconPosition="ButtonIconPosition.BeforeText" />
    <i class='@(Constants.FontAwesomeIconBasePrefix + "fa-arrows")'></i>&nbsp;
    <i class='@(Constants.FontAwesomeIconBasePrefix + "fa-user")'></i>&nbsp;
    @(Item.ApproverName + " (" +Item.ApproverEmail + ")")
</div>

ApproverItem.razor.cs is:

using Microsoft.AspNetCore.Components;

public partial class ApproverItem
{
    [Parameter]
    public ApproverTemplateDetailViewModel Item { get; set; }

    [Parameter]
    public EventCallback<ApproverTemplateDetailViewModel> OnRemoveClick { get; set; }
}

Issue:

When I build the project, I get the error:

CS7000: Unexpected use of an aliased name ProjectName <my_project>\obj\Debug\net5.0\Razor\Pages\RequestHandle.razor.g.cs

I do not understand what this error refers to but I cannot debug the project due to it preventing the build. If I goto the errro file, this is what I get:

                            __builder5.AddAttribute(506, "OnItemDrop", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::global::Microsoft.AspNetCore.Components.EventCallback<ApproverTemplateDetailViewModel>>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, 
#nullable restore
#line 318 "D:\Projects\Company\MySolution\Project Source\Portal\ProjectName\Pages\RequestHandle.razor"
                                                                                                                                       ZoneApproversItemDropped

#line default

The only issue I can see is the double global::global and the lack of a fully qualified path for the <ApproverTemplateDetailViewModel> . But this file is auto generated so I really am at lost here.

vkristijan commented 2 years ago

Wasn't able to reproduce the issue. Could you provide a minimal project where the issue happens?

Do you have the latest version of .net5? Could you try upgrading to .net6?