modelsbuilder/ModelsBuilder.Original

Support for VS2019 / run

Closed this issue · 15 comments

note: title was "Modelsbuilder custom tool is broken for Umbraco v8.0.2"

Modelsbuilder custom tool is broken in 8.0.2.
If you run it it keeps running and the only way to stop it is by force closing Visual Studio.
This hapens in VS2017 and VS2019

Since Cloud auto updated this patch on all my V8 projects I'm stuck right now for all of them...

Reproduction
Start a cloud project,
Clone the project using Uaas
Get the Modelsbuilder and API packages from nuget.
Run the custom tool.

Expected result
All default models get rendered.

Actual result
Only one model is rendered and the custom tool is stuck.

dawoe commented

@FransdeJong

When you run the models tool this normally outputs errors in the output window of VS. Don't know if you can get the message seeing that your VS is stuck. But that is very usefull in most cases

@FransdeJong

When you run the models tool this normally outputs errors in the output window of VS. Don't know if you can get the message seeing that your VS is stuck. But that is very usefull in most cases

Visual Studio is stuck and doesn't show anything. So no error just the generating models popup with the green progressbar running forever.

Is the output logged somewhere?

Output logged to Visual Studio "Output" window.

This is a weird situation + I am not sure what Umbraco 8.0.2 changed that can break MB. Nevertheless, going to try to repro.

Visual studio is frozen so the output window isn't accessible.

It is also the first time that uaas.cmd worked without errors. Maybe that does something with the project settings? Let me know if I can help you with the debugging.

Ah of course... and VS is frozen because the generation is not yet an async, background thing. Going to fix all this soonish.

See also #191 - we need to make the MB custom tool async

Small update. I wanted to start taskmanager to force close visual studio bus I misclicked and hit sign off.
After I hit cancel on the screen that warns me that I have open programs I got back to visual studio and it was generating my models and a error is present in the output window.

The source is a 404 on Umbraco\BackOffice\ModelsBuilder\ModelsBuilderApi\ValidateClientVersion

Both VS2017 and VS2019 get stuck. There is a way to generate models if you really need the power of the custom tool, but it's a ugly one:

  • Run the site
  • Edit a view so you have unsaved changes
  • Run the custom tool
  • Hit Ctrl Alt Delete and click Sign out
  • Click cancel as soon as you can

After this models are getting generated.

It has to do with some background process being killed?

Going to group that one with #204 - please see updates there (there's a new VSIX to test) and also report there. Thanks!

Test VSIX has been reported to install and run - closing issue.

I am experiencing the same issue in a new Umbraco 8.1.0 site (in both VS 2017 and VS 2019). It just runs and runs, freezing up VS. After force-closing VS I see that one Doctype has a .generated.cs file created for it, but that's it.

This is still a small site - 1 Composition DocType, 1 Nested Content DocType, 7 "regular" DocTypes.

I had MB previously working on a different 8.0.x site, in both VS 2017 and VS 2019.

Is this a cloud project? Did you start it with the uaas tool?

Can you please try to add a extra project to your solution with one single class on it and put the custom tool on that class?

There seems to be a issue that pops up in some situations that has nothing to do with the Umbraco version.

I have one project with this issue and all my other V8 projects seem to do fine...

Hi @FransdeJong - Thanks for your response.

Yes, it is a Cloud project.
Yes, I used the UaaS.cmd tool to set up the folders.

I was able to get the model files generated when I changed it to
<add key="Umbraco.ModelsBuilder.ModelsMode" value="AppData" />
and ran it from the back-office of Umbraco.

I have seen MB VS.EXT have issues when the code project the models were getting generated into had Build errors, but that would result in an error message in the Output window - not this annoying freeze up. (My project does build successfully, so I'm sure that isn't the issue this time.)

Following your suggestion, I created an additional Class Library Project, installed via NuGet:

  • UmbracoCms.Web
  • Umbraco.ModelsBuilder.Api

And copied over my current MB config .cs file. The Custom Tool ran almost instantly on that, generating all the files in the new project.

It almost seems like the additional code files in a project are getting analyzed or something while the VS EXT is running... but that is just conjecture.

Due to the way I had set up namespaces, it doesn't cause a big problem for me to utilize an extra project just for Models, so I can live with this workaround :-)

Thanks again!

Thanks for testing! Now we know it's not a isolated issue.
Stephan has my project for debugging. So hopefully this issue will be resolved.

@zpqrtbnk Looks like it has something to do with how the Uaas tool sets up the project after all.
Do you want me to create a new issue?

Good (?) news, I have been able to reproduce - created issue #210, let's discuss there.