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

CS7000 Unexpected use of an aliased name #140

Open
DoomerDGR8 opened this issue Apr 5, 2022 · 1 comment
Open

CS7000 Unexpected use of an aliased name #140

DoomerDGR8 opened this issue Apr 5, 2022 · 1 comment

Comments

@DoomerDGR8
Copy link

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
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants