Problems with save operation in Visual Studio VSIX custom editor and .Net 6.0 Web application projects - vsix

We have built a Visual Studio Extension (VSIX). It is a custom editor for editing a special file that contains definitions for the datamodel in our CMS.
We are porting our CMS to .Net 6.0 from .Net 4.8 ( framework -> core ), however we are struggling getting the editor to work in .Net 6.0 projects. It works fine in web applications written in .Net 4.8, but not in .Net 6.0 web application projects.
Whenever we click the save button in Visual Studio, we get a very general and non specific error message that says: "The operation could not be completed. Unspecified error"
We run the extension with source code in debug mode using the Visual Studio SDK, and there is no exception that is picked up by Visual Studio. ( We use one Visual Studio instance to start another instance of Visual Studio in debug mode, as normal with VSIX projects). Breakpoints etc. work, and we have activated all exceptions in the debugger. When we click save in Visual Studio projects, we get the error message before any method is called in our code. We do not even enter the "IVsPersistDocData2.SaveDocData" method of the "WindowPane" class. The plugin is written in C#. Apart from save, everything works fine. The editor loads fine and function as normal in both types of projects.
There must be some difference in the way the extension integrates with Visual Studio that differ between .Net4.8 projects and .Net6.0 projects. Of course, there are differences in file paths etc in these projects, but I do not see how this is the root of the problem as we do not even get to the stage where any method is called in our editor source code.
As a test I created a very simple extension with only the bare minimum to enable a WindowPane extension, and I get the same error message when saving in 6.0 projects
We created the first version of the plugin back in 2013, using templates from Microsoft and have been updating it for every new version of Visual Studio. There have been some changes in the documentation and projects templates for VSIX, but unfortunately, there is no longer any C# template for custom editors, only C++. (https://learn.microsoft.com/en-us/visualstudio/extensibility/walkthrough-creating-a-custom-editor?view=vs-2022) Pherhaps someone knows any workings examples of custom editors written in c#?
So, we are a little stuck, the error message does not give us any clue to what is wrong. I have not found any documentation that could explain differences in Net 4.8 and Net 6.0 web projects that could cause this.
Anyone had a similar problem? Or perhaps a clue to what is causing this.
(BTW, we are using the latest version of Visual Studio 2022 Community and Windows 11)

After opening a support incident with Microsoft, further investigation and live debugging pointed to problems with VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.SaveItem and a possible internal bug in Visual Studio.
A temporary workaround suggested by Microsoft support, was to add the definition of IPersistFileFormat to the WindowPane implementation. ( None of the methods needed to be implemented. )
This solved the problem for us. The definition of our working WindowPane is now:
public sealed class OntologyDesignerEditorPane : WindowPane, IVsPersistDocData2, IPersistFileFormat, IVsFileChangeEvents

Related

Why is my visual studio code not displaying my errors or intellisense?

No matter what c# script i boot up, no errors are displayed and neither is IntelliSense.
I've reinstalled vsc, reinstalled some extensions, made sure errors are turned on but nothing seems to work.
They work fine in regular vs but not vsc.
VScode by default only support web technologies if you want to use it for other programming languages you have to install microsoft dedicated extension for that technology like - C# for VScode

Visual Studio Code replacing Visual Studio

I just came to know about Visual Studio Code. I would like to know, can I replace Visual Studio for all .NET development related work?
Can I save my cost of Visual Studio licensing?
What is there in Visual Studio which is not there in Visual Studio Code?
This question already has an answer here and here.
The list of differences is huge.
Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS,
with emphasis in just writing the code instead of dealing with
debugging, compiling, testing, refactoring, and all the other things
that make Visual Studio great.
The people using Visual Studio Code will probably be those on a Mac
who will just deal with client-side technologies (HTML/JS/CSS) and do
not want to install Windows in order to do that.
People using Windows and developing C#, F# or VB will continue to use
Visual Studio 2015.
Also the difference is that .NET has been split into two: .NET Core
(Mac/Linux/Windows) .NET Framework (Windows only) All native user
interface technologies (Windows Presentation Foundation, Windows
Forms, etc) are part of the framework, not the core.
Also, Visual Studio tends to be oriented around Projects & Solutions.
Projects have a large amount of scaffolding (pre-generated starting
templates) and features.
VS Code looks to be presently oriented around files, as a glorified
text editor, and no project scaffolding exists.
Source : MSDN forum and quora

Target users of Visual Studio Code?

I've been developing on Visual Studio, and here comes Visual Studio Code which is described as a source code editor that supports multiple platforms. For me, I find it promising considering it's a lightweight editor compared to Visual Studio.
Since Visual Studio Code is still a baby, is it safe to say as time passes by and this baby becomes mature, this will be the new Visual Studio considering it can run on multiple platform?
Does Visual Studio Code has a roadmap on the upcoming features?
Visual Studio Code will not replace the regular Visual Studio, if that's what you're asking. VSCode is intended to be a very lightweight, code-focused IDE. There are a plethora of features present in Visual Studio that I don't expect we'll ever see in VSCode simply because they are not within the scope of the project. For example, I don't think you'll ever see the designer in VSCode, which is something you would sorely miss if you were developing a WPF or WinForms application.
Right now VSCode seems to be mostly targeting web application developers using ASP.NET 5 and node.js.
As for what's ahead for VSCode, I'm not sure if a roadmap has been laid out anywhere but I do know that a plugin/extension system is in the works, along with ES6/7 support and a few other things.
If you want to follow the development of VSCode, check out their blog, Twitter, and UserVoice.

Visual Studio Ultimate 2013 crashes when using Entity Framework Power Tools Beta 4

I'm running VS Ultimate 2013 on a Windows 8.1 machine and have been successfully for several months now. However, I just installed the NuGet package for Entity Framework Power Tools Beta 4 today and am having issues. After installing EFPT, I restarted VS, loaded my solution, made my "data" project the startup project, right-clicked on my class deriving from DbContext -> Entity Framework -> Generate Views. Visual Studio completely crashes and restarts. I've tried clicking on other options in in the EFPT context menu such as "View Entity Data Model (read-only)" and all of them results in VS completely crashing and restarting.
I was running VS with Update 3, so I installed Update 4 and still the same issue. It does NOT crash if running devenv.exe in safemode, but EFPT doesn't actually DO anything either.
So now, I'm running VS version 12.0.31101.00 Update 4 with .NET Fx 4.5.51641 and Entity Framework 6.1.2.
Ultimately, I'm trying to create a EDM mapping file for my code-first EF context to cache and reduce startup time. If this issue I'm having is a known issue, is there a fix OR a workaround in generating this mapping???
Thank you Erik. I wanted to answer my own question because I was able to take it a step further. Rather than writing (a LOT) of code to generate cached views and having to run it every time your code changes.
A dev on the SignalR team at Microsoft, Pawel Kadluczka, wrote a nice and EASY-TO-USE bit of code that can be installed via NuGet. The "Interactive Pre-Generated Views" project, when added to your data assembly, will look for cached views and if not found, generate them on the fly. Out of the box, it supports both file and db cached view info.
The only bit of code I had to add to utilize this was:
static DynamicDbContext()
{
InteractiveViews.SetViewCacheFactory(new DynamicDbContext(), new FileViewCacheFactory(_SCRIPT_DIRECTORY + "dbviews.xml"));
}
It literally took me 5 minutes to install, write the bit of code, execute and confirm.
It needs to run prior to any query being executed with your dbcontext and so he recommends this bit of code to be placed in a static ctor of your custom dbContext.
Pawel's blog post where he describes it is: http://blog.3d-logic.com/2013/12/14/using-pre-generated-views-without-having-to-pre-generate-views-ef6/
You can install via NuGet or read more about it on CodePlex: https://efinteractiveviews.codeplex.com/

Entity framework starter kit on VS 2012

I have downloaded and installed the Entity Designer Starter Kit on both VS 2010 and 2012. I've created a project and have customized that project to allow me to add (for now) three attributes for each field value: See Below: (I'd post the image but I've only started posting here and I don't have 10 points) :(
As you can't see above, the Extension is working...on VS 2010, however, we need to use VS 2012 - so we can have the new support for geography fields in our Model, but it doesn't seem to work in VS 2012. The extension shows up as an installed extension in the Extension Manager in both versions, but doesn't work (or do anything in 2012.) when we build a new Model or open an existing one. :(
I've looked at the manifest for versioning info, and it DOES show up in the Extension Manager as having been installed (in both versions). (See part of Manifest below -- We are using the Professional version of 2012)
<SupportedProducts>
<VisualStudio Version="11.0">
<Edition>VSTS</Edition>
<Edition>VSTD</Edition>
<Edition>Pro</Edition>
<Edition>Express_All</Edition>
</VisualStudio>
<VisualStudio Version="10.0">
<Edition>VSTS</Edition>
<Edition>VSTD</Edition>
<Edition>Pro</Edition>
<Edition>Express_All</Edition>
</VisualStudio>
</SupportedProducts>
Does anyone have any idea why its not running in 2012?
Thanks for any help!!!!!!!
bob
Back in 2010 I found that the Starter Kit did not work, perhaps due to the version being for VS2010 RC.
So I rebuilt it, and today, I've just upgraded it to VS2012.
So you can get it from my Blog.
All I did was run it though the VS upgrade wizard, and then change the manifest to VS2012 and it worked fine. Perhaps you could explain a little more "geography fields", as I've not read up yet on any of the changes in VS2012.
http://www.jsrsoft.co.uk/blog/post/Entity-Framework-Starter-Kit-alternative