modelsbuilder / ModelsBuilder.Original

The Community Models Builder for Umbraco
MIT License
114 stars 49 forks source link

Support for VS2019 / run #199

Closed FransdeJong closed 5 years ago

FransdeJong commented 5 years ago

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 5 years ago

@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 commented 5 years ago

@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?

zpqrtbnk commented 5 years ago

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.

FransdeJong commented 5 years ago

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.

zpqrtbnk commented 5 years ago

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

zpqrtbnk commented 5 years ago

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

FransdeJong commented 5 years ago

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

FransdeJong commented 5 years ago

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:

After this models are getting generated.

It has to do with some background process being killed?

zpqrtbnk commented 5 years ago

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

zpqrtbnk commented 5 years ago

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

hfloyd commented 5 years ago

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.

FransdeJong commented 5 years ago

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...

hfloyd commented 5 years ago

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:

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!

FransdeJong commented 5 years ago

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?

zpqrtbnk commented 5 years ago

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