VS20087 AddIn Problem
-
Hi, I busy fixing a Addin for Visual Studio. Basically generating a source file. The class with its methods get generated fine, but when I save the generated source it get additional closing brackets. This line cause additional bracket to be inserted: applicationObject.ActiveDocument().Save(""); Can anyone please tell me why? Regards Full Code:
TextSelection testSelection = applicationObject.GetActiveDocument().Selection as TextSelection; if (testSelection != null) { testSelection.SelectAll(); string val = GenerateCode(targetNamespace,targetClass, testClassName); testSelection.Text = val; } applicationObject.GetActiveDocument().Save("");
-
Hi, I busy fixing a Addin for Visual Studio. Basically generating a source file. The class with its methods get generated fine, but when I save the generated source it get additional closing brackets. This line cause additional bracket to be inserted: applicationObject.ActiveDocument().Save(""); Can anyone please tell me why? Regards Full Code:
TextSelection testSelection = applicationObject.GetActiveDocument().Selection as TextSelection; if (testSelection != null) { testSelection.SelectAll(); string val = GenerateCode(targetNamespace,targetClass, testClassName); testSelection.Text = val; } applicationObject.GetActiveDocument().Save("");
Don't worry, fixed it myself. Was related to TextSelection and Resharper being clever. When assigning TextSelection.Text, Reshaper try to insert the correct matching brackets. The right use for TextSelection is to use the Insert method. testSelection.Insert(val, (int)vsInsertFlags.vsInsertFlagsInsertAtStart);