AdaskoTheBeAsT/Typewriter

Error when render all templates

Opened this issue · 10 comments

I have an error that I get when I render all templates, and I don't get when I run each one

12:14:47.380 ERROR: Cannot find path of project item Object reference not set to an instance of an object.


Microsoft Visual Studio

The path is not of a legal form.

OK

My idea is to put more details in this error.

can you check now? Typewriter is using different way of saving files to workaround 260 characters path limitation

I still get the error

15:05:21.392 ERROR: Cannot find path of project item Object reference not set to an instance of an object.

and the message
The path is not of a legal form.

Is there a way that I can generate more details on the error?

can you please share part of your template?

I'm not sure I can share all of it, and it only happens when I press "render all templates" If I render each template one by one I don't get this error

Is there a way that I can generate any log and send here?

I have templates which are quite complicated and generate ~200 models - without even sliced template I will not be able to narrow the problem based only on logs

I think that I explained it wrong
this project has about 20 template files (*.tst)
if I render one template each at a time, there is no error reported.
image

If I render all templates in one command, then I get the error.
image

The same templates in another project doesn't give the error, even if I render all the templates in one command
For me to send something to you, I need to send you all my code.

I want to help you, but I need help to help you, I need some log or some detailed information to see what's goind on
I tested the v2.22.0 Version right now, and got the same error

the only thing which can be problematic is when those templates try to operate on same file - did you try to move half of tst files outside of that folder run all templates - if it works then check second part of templates - maybe by using that you will narrow to two or more conflicting templates

the only thing which can be problematic is when those templates try to operate on same file

They are in different folders, I mean, never the output file name conflicts, but there are cases where I have 2 templates in the same folder, to save one as .ts and other as .html, could be a temporary file with the same name and extension? that in the final could be the same name and different extension

I mean

Suppose that you save a temporary file in the execution folder, if I have two templates in the same folder I could have this conflict

This make any sense?

files are written directly - there are no temp files - please create minumum reproductible - without it I can't analyze stuff

I have the same problem, if i do "Render All Templates" it give me the error "ERROR: Cannot find path of project item Object reference not set to an instance of an object.".

@AdaskoTheBeAsT i checked the source code and the error is written in this method:

File: src\Typewriter\Generation\Controllers\SolutionExtensions.cs

public static string Path(this ProjectItem projectItem)
{
    return ThreadHelper.JoinableTaskFactory.Run(async () =>
    {
        await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
        try
        {
            return projectItem.Properties.Item("FullPath").Value.ToString();
        }
        catch (Exception e)
        {
            Log.Error($"Cannot find path of project item {e.Message}");
        }

        return null;
    });
}

can you add more info in the Log.Error message to track the issue?