Search code examples
unity-game-enginevisual-studio-2017

Any way to stop Visual Studio adding 'throw new NotImplementedException' on new functions? Causes namespace conflicts with Unity


Yes, I know this is good practise normally but the problem in Unity is it causes the System namespace to be added which breaks several Unity classes such as Random unless I fully qualify them which is tedious :). Is there any way to disable it from adding the throw? I've tried searching for a snippet for it but have drawn a blank. This happens when doing 'Generate Method' from Alt-Enter after typing in 'DoSomething();'

enter image description here


Solution

  • Yes, you can change this default behavior by changing the snippet that creates it. That snippet is located at the following location: (caveat...this will change it across the board for VS2017)

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC#\Snippets\1033\Refactoring\MethodStub.snippet