aspnet / RazorTooling

Razor tooling for Visual Studio 2015

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

internal methods are not detected as internal and end up as runtime compile errors

KLuuKer opened this issue · comments

when using internal methods\classes\etc they are handled just like normal public methods in vs tooling
when it really should say that it's internal and cannot be used in the view

MyView.cshtml

@{
    new MyClass(); // this throws at runtime. but it's highlighted like any other public class during design time
}

MyClass.cs

internal class MyClass
{
    internal MyClass()
    {
    }
}

the same issue also occurs when trying to use extensions methods inside the view like

internal static class MyExtensions
{
    internal static void MyHelper(this HttpContext context)
    {
    }
}

using RazorTooling 1.0.0-preview3-final

@NTaylorMullen @rynowak @ToddGrun thoughts on this? Does this have to do with how Razor documents are opened in the editor? And would this be fixed with Razor-evolution?

@Eilon this is definitely due to how the VS tooling bits are representing the Razor project with Roslyn. At runtime the Razor view is considered its own assembly and at tooling time it seems that it's being treated as part of the same assembly as the users project.

Depending on how the Razor-evolution bits integrate with VS it may or may not fix the problem. We've yet to delve into who will be responsible for setting up the Razor Roslyn project. Could go two routes, VS sets it up and the Razor server uses that; other approach is the Razor server sets it up and VS uses what was set up for it.

We should fix this on Todds end.

Where's the right place to track this bug?

This issue was moved to aspnet/Tooling#883