question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CS0103 C# The name 'context' does not exist in the current context

See original GitHub issue

Visual Studio 2019 does not see part of the component when using using

To Reproduce

  1. Create a component in a different folder.
  2. Connect it anywhere using using
  3. Error “CS0103 C # The name ‘context’ doesn’t exist in the current context”

Screenshots

http://dt-byte.ru/fcb6801d.png

Additional context

dotnet --info
Пакет SDK для .NET Core (отражающий любой global.json):
 Version:   3.0.100-preview4-011223
 Commit:    118dd862c8

Среда выполнения:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\

Host (useful for support):
  Version: 3.0.0-preview4-27615-11
  Commit:  ee54d4cbd2

Components/TableView.razor

@typeparam TItem

@for (var i = 0; i < Items.Count; i++)
{
    <p>@Body(Items[i])</p>
}

@functions{
    [Parameter]
    IReadOnlyList<TItem> Items { get; set; }

    [Parameter]
    protected RenderFragment<TItem> Body { get; set; }
}

Pages/index.razor

@page "/"
@using Blazorside.Components

<TableView Items="@Items">
    <Body>
        @context
    </Body>
</TableView>

@functions{
    List<string> Items { get; set; } = new List<string> { "one", "two" };
}

For clarity, I’ll clarify that the error occurs only in Visual Studio and only if TableView.razor is in a different folder, the project itself is being built and working.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
danroth27commented, Apr 22, 2019

If the project builds successfully on the command-line, then this looks like a known tooling limitation with VS2019 16.1 Preview 1, which will get fixed shortly with Preview 2. To workaround the tooling issue you should be able to fully qualify the component tag name with the component’s namespace.

2reactions
marin-bratanovcommented, Apr 23, 2019

May be related - when in a subfolder (like ~/Shared/someFolder/myComponent.razor), the components’ intellisense does not recognize the [Parameter] attribute, but it does compile and work.

parameter-not-recognized-fixed-color

Edit: fixed screenshot

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - error CS0103: The name ' ' does not exist in the current ...
ENGLISH: 'does not exist in the current context' usually means you are missing a "using" statement OR the variable is out of scope....
Read more >
Compiler Error CS0103
An attempt was made to use a name that does not exist in the class, namespace, or scope. Check the spelling of the...
Read more >
C# Error CS0103 – The name 'identifier' does not exist in the ...
You will usually receive this error when you are trying to use a identifier name in C# that doesnot exist with-in the current...
Read more >
Giving error "Error CS0103 The name 'Context' does not ...
While compiling it is throwing error "Error CS0103 The name 'Context' does not exist in the current context".
Read more >
The name [name] does not exist in the current context
If you're being told that those names don't exist in that context, the most likely reason is that those names don't exist in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found