title: Linq - Range variable hides a variable in an enclosing block
body: <p>I have several Linq statements in a public procedure (here are 2 of them):</p>
  
  <pre><code>'this one gets us table like this: "number of tickets, day"
  Dim ticketsCreated = From ticket In CreatedTickets
     Group ticket By GroupKey = New With {Key .IssueDate = CDate(ticket.Date).Date}
     Into g = Group Select New 
         With {Key .IssuesCount = g.Count(), Key .IssueDate = GroupKey.IssueDate}
  
  'this one gets us table like this: "number of tickets, day"
  Dim ticketsClosed = From ticket In ClosedTickets
      Group ticket By GroupKey = New With {Key .IssueDate = CDate(ticket.Date).Date}
      Into g = Group Select New 
           With {Key .IssuesCount = g.Count(), Key .IssueDate = GroupKey.IssueDate}
  </code></pre>
  
  <p>I get the follwoing error on GroupKey in both statements:</p>
  
  <pre><code>Range variable hides a variable in an enclosing block, a previously defined range variable, 
  or an implicitly declared variable in a query expression
  </code></pre>
  
  <p>I do not have a variable named GroupKey declared anywhere outside of my Linq statements.</p>