title: Why is my SQL CLR stored proc call claiming I am not providing a parameter I am?
body: <p>In a CLR procedure I have the following method:</p>
  <pre><code>private static void EndOwnershipForTeam(long assetId, int teamId)
  {
      const string storedProcedureName = @&quot;up_RemoveAssetOwnershipFromTeam&quot;;
  
      using (var connection = new SqlConnection(&quot;context connection=true&quot;))
      using (var command = new SqlCommand(storedProcedureName, connection))
      {
          command.Parameters.AddWithValue(&quot;assetId&quot;, assetId);
          command.Parameters.AddWithValue(&quot;teamId&quot;, teamId);
  
          connection.Open();
          command.ExecuteNonQuery();
      }
  }
  </code></pre>
  <p>When I run this method is called I am getting the following error:</p>
  <blockquote>
  <p>Msg 6522, Level 16, State 1, Procedure cp_RemoveAsset, Line 0</p>
  <p>A .NET Framework error occurred during execution of user-defined routine or aggregate &quot;cp_RemoveAsset&quot;:</p>
  <p>System.Data.SqlClient.SqlException: Procedure or function 'up_RemoveAssetOwnershipFromTeam' expects parameter '@assetId', which was not supplied.</p>
  <p>System.Data.SqlClient.SqlException:</p>
  <p>at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)</p>
  <p>at System.Data.SqlClient.SqlCommand.RunExecuteNonQuerySmi(Boolean sendToPipe)</p>
  <p>at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)</p>
  <p>at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()</p>
  <p>at StoredProcedures.EndOwnershipForTeam(Int64 assetId, Int32 teamId)</p>
  <p>at StoredProcedures.cp_RemoveAsset(SqlInt32 userId, SqlString xaid)</p>
  </blockquote>
  <p>Since my code is supplying the parameters (verified by displaying output via <code>SqlContext.Pipe.Send()</code> calls) why is it claiming that I&quot;m not supplying a parameter I actually am?</p>