aspnet / RazorTooling

Razor tooling for Visual Studio 2015

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pasting bad code over bad code crashes VS

victorhurdugaci opened this issue · comments

  1. Create a new web application (no authentication)

  2. Open the Home/Index view and paste this code (ignore any compilation errors):

    @using BuildDashboard.Server.Models.Dashboard
    @using SectionLayout = BuildDashboard.Server.Models.Dashboard.Layout
    
    @model SectionTile
    
    @{
    const int MinGridItemSize = 2;
    const int GridSpaces = 12;
    const int MaxItemsPerRow = GridSpaces / MinGridItemSize;
    }
    
    <div class="page-header">
    <h1>@Model.Title</h1>
    </div>
    
    @*@if (Model.Layout == SectionLayout.Normal)
    {
    foreach (var tile in Model.Tiles)
    {
        @await Component.InvokeAsync("Tile", new { tile })
    }
    }
    else
    {
    var itemsPerRow =
            }*@
    
  3. Save

  4. Copy the code below

    @using BuildDashboard.Server.Models.Dashboard
    
    @model SectionTile
    
    @{
    const int GridSize = 12;
    
    var actualItemsPerRow = Model.ItemsPerRow;
    if (actualItemsPerRow < 1)
    {
        actualItemsPerRow = 1;
    }
    else if (actualItemsPerRow > 12)
    {
        actualItemsPerRow = 12;
    }
    
    while (GridSize % actualItemsPerRow != 0)
    {
        --actualItemsPerRow;
    }
    }
    
    <div class="page-header">
    <h1>@Model.Title</h1>
    </div>
    
    <div>@actualItemsPerRow</div>
    
    <!--@*@if (Model.Layout == SectionLayout.Normal)
    {
    foreach (var tile in Model.Tiles)
    {
        @await Component.InvokeAsync("Tile", new { tile })
    }
    }
    else
    {
    var itemsPerRow =
            }*@-->
    
  5. Go back to the view

  6. Select all

  7. Paste

Result: VS crashes

VS version: 14.0.23107.0 D14REL
Tooling: 14.1.11116.0

@victorhurdugaci - can you get dmp file?

Sure, if you tell me how to do it :)

Note: This probably should be moved to the aspnet/Tooling repo.