C# EnvDTE and TFS massive problems

341 views Asked by At

I have created a vsix plugin for VS 2015 that receives some data of a REST-Service, writes it into a file and then it adds the file to my C# Project.

Well the problem is that after the files were written on the file system and integrated to the project my user input in visual studio is blocked:

e.g. I can write for example "asdf" in a code file, but when I try to delete the text with the backspace button it is not working. Other buttons like CTRL are also not working.

The interesting part is when I close VS2015 the following error appears: enter image description here

The problem is definitly caused by this line:

project.ProjectItems.AddFromFile(filePath);

project is an EnvDTE.Project object! The thing is the files were added to my project but I have to kill and restart VS to continue with my work.

I have also found a little workaround: When I disable TFS in my project all is working fine!

So my conclusion is that the problem is caused by TFS! Can anybody tell me what I can do, to solve this problem! It costs me a ton of time to restart VS every time!

2

There are 2 answers

2
Eduardo Elias Saléh On BEST ANSWER

The problem here is not what you are doing, but how. Some modal window you are opening it's been locked to the screen. Make sure you closed it correctly.

This behavior it's common when using modal. Try to figure it out what window you are opening and try change it from modal to not-modal.

It will stop this problem.

0
zaitsman On

When using TFS, you need to checkout the project for modification first, use SourceControl.CheckoutItem: https://msdn.microsoft.com/en-us/library/envdte.sourcecontrol.checkoutitem.aspx