CS0103 C# The name 'context' does not exist in the current context
See original GitHub issueVisual Studio 2019 does not see part of the component when using using
To Reproduce
- Create a component in a different folder.
- Connect it anywhere using
using
- 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:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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.Edit: fixed screenshot