private void UpdateExistingTryCatchBlock(CSharpElementFactory elementFactory, ITryStatement block, string exceptionTypeName) { // There is no way to create a catch clause so we need to create a fake try statement with our // catch clause and copy it to the currently selected clause. var statement = elementFactory.CreateStatement("try{}catch($0 ex){}", exceptionTypeName); ITryStatement tempTryStatement = statement as ITryStatement; if (null == tempTryStatement) return; block.AddCatchClause(tempTryStatement.Catches[0]); }