microsoft / XmlNotepad

XML Notepad provides a simple intuitive User Interface for browsing and editing XML documents.
https://microsoft.github.io/XmlNotepad/
MIT License
968 stars 207 forks source link

Schema Import Error #342

Closed elesliemeehan closed 9 months ago

elesliemeehan commented 10 months ago

Following an update, I can no longer import schemas using "Add Files" item in the [File Menu]. Nothing happens. Attempting to add schemas from the browse button on the right side results in the following error which persists when attempting to add any schema:

Error loading schema '[filepath_name]' The 'Attribute' attribute is not supported in this context.

XML Notepad v2.9.0.6 Windows 10 Enterprise OS 10.0.19045 Build 190045

lovettchris commented 10 months ago

Hi Erin, thanks for the bug report, I'm investigating, but everything seems to work fine when I use my sample schemas (basket.xsd and employee.xsd). Can you share the exact repro steps:

  1. what xml file is open (or is it blank)
  2. what schemas are you trying to associate using the schema dialog.
  3. when does the error show up, immediately or when you close the dialog?
elesliemeehan commented 10 months ago

Hey Chris, It does it when trying to create a new file or working with an already existing file. There is only 1 schema I'm trying to use. It worked previously. I added the schema and the intellisense guided me well.

Errors show up when trying to add a scema. I made a screencast.

I'm thinking of contacting our Corp Help Desk to unistall the app, then I'll use the one-click installer to install it again. Maybe that would help?

UPDATE: XML notepad was uninstalled and reinstalled. No change. With XML Notepad open and a xml doc open, I reset the Options/ Settings back to default. I got a new error and I'm attaching the screenshot for it. I've no clue what any of it means.

2023-09-29_13-49-27

https://github.com/microsoft/XmlNotepad/assets/16970665/5104a242-8f8c-46e2-9132-4aa9c6bfde31

lovettchris commented 10 months ago

Thanks very much for the additional details and the video, very clear. Is it possible to zip the xml and xsd files and send them to me? If you don't want to share them publicly here you can email them to me - my email is clovett @ the company I work for .com.

lovettchris commented 10 months ago

The stack trace you included is very helpful -- I see a lot of chatter online about this being a bug in the .NET Framework version that this app is built on. Your stack includes a mouse event which is the trigger for this particular bug. So one thing you could try is to move the mouse completely away from the schema dialog, and use only the key board to add a schema by doing this:

  1. Alt+V - to bring up the View menu
  2. m - to select schema dialog
  3. Alt+F - to bring up the File menu on the schema dialog
  4. a - to select "Add schemas"
  5. type in the file name in the open file dialog and press enter

All while the mouse is very far away from the schema dialog. Let me know if this works for you, thanks.

lovettchris commented 10 months ago

And the reason I cannot repro this issue might be because I'm using a newer version of .NET 4.0. Can you make sure you have .NET 4.7.2 installed from here:

https://dotnet.microsoft.com/en-us/download/dotnet-framework/net472

Use the Download .NET Framework 4.7.2 Runtime link.

I can also move XML Notepad to .NET 4.8 easily to see if that fixes it for you.

PS: The .NET Framework is a platform for building apps that XML Notepad uses.

elesliemeehan commented 10 months ago

Hey Chris, The company controls our software intalls for everything. I found some info online that guided me to find the .net version I have. I took a screenshot. If I'm looking at this correctly, there are a few .net versions I have installed by looking at client and version. By any chance, did anything change that would have impacted the issue about 2-3 updates ago? That was the last time I was able to build a XML file in XML Notepad with a schema. I've started using this more and wanted to train some employees on it, too.

I tried the instructions for the adding the schema via keys, with my cursor far from the schema dialogue box. Didn't work. I attached the screencast.

I'm going to send you the zipped xml file and zipped xsd. It will be coming from my work email but will have my name. I'm guessing at the company you work for, but I did a little bit of reading and found you online.

I will contact our Corporate Help Desk Monday to get them to download .net 4.72 on Monday. It required admin level permission in our organization. (I don't have that. I'm a peon. lol)

Thank you for your help!

https://github.com/microsoft/XmlNotepad/assets/16970665/de6fb7b8-e8b4-4e30-95c4-11fe5697b8d6

2023-09-29_19-02-14

lovettchris commented 10 months ago

Ok, wow, super helpful again, thanks so much. This I think confirms we are on different versions of .NET 4.0, my version is:

Version REG_SZ 4.8.09032

Which means I'm on .NET 4.8. So if you could get your admins to install .NET 4.8 that would be perfect.

I also found the problem in your schema as to why it was not loading in the Schema dialog, line 470 has this:

and that Attribute attribute is not allowed. Removing this so it looks like this:

Solves the problem and the schema loads and the intellisense works. It was a bug in XML Notepad that it did not show you this error which I have also fixed.

Attached is a new installer for XML Notepad that is built for .NET 4.8 just to see if that fixes the issue also.

XmlNotepadSetup.zip

This version also has a new feature which is when you start with a new empty XML file, add a schema then start adding a new root XML element you will now get some intellisense from those schemas showing allowed root elements like this:

image

elesliemeehan commented 10 months ago

Wow Chris. You're amazing. Truly.

I'm going to let our vendor whose SOAP WS we are using know they have an error in their schema. They provided that file. I had found a couple other errors previously as well.

I will get our help desk involved to install 4.8 and the XML Notepad installer you provided. I think I can have them do it possibly Saturday. I believe they're support is 24/7 at work.

I'll update you as soon as I can on the outcomes.

Thank you so very much for being incredibly responsive and so fast to troubleshoot and resolve this. I'm serioulsy impressed and I don't impress easily. I have obsurdly high standards. lol

elesliemeehan commented 9 months ago

Hey Chris!

I'm sorry it has taken this long to get back to you. I have been waiting on Desktop Support for the installs.

Regarding .Net 4.7.2, the company has it blocked from being installed due to security. I asked what that meant and the T2 tech didn't know. He said it could be anything from being buggy to a vulnerability to incompatibility with BW's stack. No one here at BW can have this version. That's a few thousand units worlwide that don't have .Net 4.7.2.

XML Notepad v2.9.0.7 that you moved to .Net 4.8 works marvelously. The added intellisense features are great, too. There are no errors, I can add schemas both ways now, and everything is very smooth.

Thank you for your help on this! This tool is my go to for code review and writing files for SOAP.

lovettchris commented 9 months ago

Hi, no problem, thanks for getting back to me. I will move everything to .NET 4.8 then, it's always good to keep updated to the newer versions anyway. It will take a little while since I want to also figure out how to make the installer get .NET 4.8 for folks that don't already have it, so they get a smooth upgrade experience.

elesliemeehan commented 9 months ago

Thanks!

I'm not sure if I should close this issue or not since it is resolved now? I'll let you do the honors if you like. lol

lovettchris commented 9 months ago

Release 2.9.0.7 is now available.