Sysprogs forums › Forums › VisualGDB › Custom Template Exception
- This topic has 25 replies, 2 voices, and was last updated 7 years ago by support.
-
AuthorPosts
-
November 12, 2017 at 01:43 #12965sidpriceParticipant
I just created a new custom template and when I try to use it I get the following exception:
VisualGDB version: 5.3.8.1771
—————— System.NullReferenceException ——————
System.NullReferenceException: Object reference not set to an instance of an object.
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at System.Windows.Forms.RadioButton.PerformAutoUpdates(Boolean tabbedInto)
at System.Windows.Forms.RadioButton.set_Checked(Boolean value)
at v31.q(EmbeddedUserProjectTemplate c, Boolean e, CLanguageStandard d, ImportedExternalProject b, String a)
at VisualGDB.Wizard.Embedded.EmbeddedProjectWizardImpl.k.h(ej a)
at ej.a1_2(g1 a)
at v31.a1_2(g1 a)
at w31.b1(Int32 a)I have attached the template.
Sid
November 12, 2017 at 01:45 #12966sidpriceParticipantSeems your server didn’t like my file, trying as a ZIP file.
Sid
Attachments:
You must be logged in to view attached files.November 12, 2017 at 05:49 #12969supportKeymasterHi,
Thanks, looks like our bug. Please try this build: http://sysprogs.com/files/tmp/VisualGDB-5.3.16.1925.msi
November 12, 2017 at 15:55 #12970sidpriceParticipantThanks that fixed the exception, however I needed to add some extra files to the template and after I edited it to add those I get a new exception:
VisualGDB version: 5.3.16.1925
—————— System.Exception ——————
System.Exception: Invalid project template file
at VisualGDB.Backend.UserProjectTemplate.FromPackage(String fn)
at VisualGDB.WPF.Wizards.Embedded.EmbeddedProjectTypePage.ControllerImpl.CommitPage(m commitMode)
at v6.i_2(m a)
at xc1.l1(Int32 aThe edited template is attached,
Sid
Attachments:
You must be logged in to view attached files.November 12, 2017 at 18:57 #12974supportKeymasterHi,
The attached template file is indeed broken (has contents inside a subdirectory). To troubleshoot this type or problems please try creating a new template, rename it to .zip and compare its contents with your edited template side-by-side.
November 12, 2017 at 19:14 #12975sidpriceParticipantSo I can’t have files in sub-folders in a template?
Sid
November 14, 2017 at 02:23 #12986sidpriceParticipantPlease can you confirm if the template allows for content in sub-folders. I need to have some files in my template that are not in the project root.
Thanks,
Sid
November 14, 2017 at 19:22 #12992supportKeymasterHi,
You can add subfolders to the template file as long as you don’t move other files inside it. E.g. the template.xml file needs to be always in the root directory of the template.
Generally if you are not comfortable manually editing the templates, please rely on VisualGDB to generate them automatically – add all necessary files to the Visual Studio project and then create a template. Hacking the template files manually is possible, however is more error-prone than generating them automatically and we generally don’t recommend doing it unless you are ready to troubleshoot errors caused by unexpected modifications.
November 15, 2017 at 16:41 #12995sidpriceParticipantI am more than comfortable “hacking” template files given the correct information.
In reply to my question; Please can you confirm if the template allows for content in sub-folders … you wrote “You can add subfolders to the template file as long as you don’t move other files inside it”
I did not move any files into the sub-folders I created that were a part of the VGDB template, I only added the files I needed.
So, can sub-folders have content (including otehr sub-folders) inside them?
Second point, the original template I tried was generated from a project that had all the files and sub-folders I needed in the template, however, the template did not have those sub-folders or files included. You then told me to add them manually, which I did.
Please clarify what may or may not be added to the template, any file in the generated template being left where it is.
Sid
November 15, 2017 at 21:48 #12996supportKeymasterHi,
Yes, the template allows adding sub-folders, however the folders shown in Solution Explorer don’t always correspond to the physical subfolders on the disk. VisualGDB automatically preserves both when creating/restoring templates, however if you want to edit the templates manually, please ensure you understand the difference between them as confusing the paths would make the template unreadable.
To diagnose corrupt templates, please download 7-Zip and run the following command line for both working and a broken templates:
7z.exe l <template file>
This will list the contents of both files. Please carefully compare the outputs for the 2 template files (and the unpacked template.xml files) and double-check all differences.
As we may change the internal template format in the future, we don’t provide specific instructions on editing it manually and don’t guarantee that this will always work, sorry. The only officially supported way of doing this is using VisualGDB template export GUI. We made the template format easily editable (zip+xml) to make advanced tweaking possible, however this is something to do purely at your own risk. If the inconvenience from troubleshooting accidentally broken templates doesn’t outweigh the advantages of manual tweaking, please don’t use this feature and use the GUI instead.
November 16, 2017 at 17:24 #13006sidpriceParticipantI would LOVE to use the template GUI in VGDB, however the GUI approach appears incomplete if there are files that are required by the project but that are NOT included in the project.
For example, I have a linker script file that is included by the main linker script. If I add this secondary script file to the project the build fails. If I exclude it from the project then the template GUI does not include in in the template. Note that with VS2015 I do not see an option to “Exclude from build” only “Exclude from Project.”
The only way I find to work around this is to have the secondary file as a part of the project, do the template export, create a new project from the template and then remove the file from the project. It would be so nice if the export GUI presented an interface to add additional files.
Sid
November 17, 2017 at 05:44 #13008supportKeymasterNo problem, we can help you get GUI to work – this is 100% supported.
VisualGDB will only include a file in the template if both of the following holds for it:
- The file resides inside the project directory (or one of its subdirectories)
- The file is explicitly included in the project in Solution Explorer
E.g. the following files won’t be included:
- Any sources outside the project directory (with relative paths starting with ..\)
- Linker scripts unless you explicitly add them to SolutionExplorer and copy under the project directory
- Any header files included from your sources, but not present in Solution Explorer or residing outside the project directory
Hope this helps. If not, please let us know which file you are trying to include, where is it located and how does it look in Solution Explorer (i.e. its item type and relative path).
November 17, 2017 at 22:22 #13010sidpriceParticipantI thought I had explained this …
For example, I have a linker script file that is included by the main linker script. If I add this secondary script file to the project the build fails. If I exclude it from the project then the template GUI does not include in in the template
The file I have trouble with is a secondary linker script. It is located in the project folder. It CAN NOT be added to the project or the build system complains. This file is included by the primary linker script.
Sid
November 18, 2017 at 04:24 #13011supportKeymasterHi,
Please, please, please always provide more details about the errors you encounter. We would absolutely love to help you, but it is almost impossible to guess what is going on without knowing the exact error messages. VisualGDB build system is complex and it could be broken by incorrect settings in tens of different options, each one resulting in a different error message. Unfortunately we cannot provide much help without knowing the exact message shown by the build system.
November 18, 2017 at 16:07 #13013sidpriceParticipantThe secondary linker script is not found because it is not included in the custom template.
Sid
-
AuthorPosts
- You must be logged in to reply to this topic.