Closed musictopia2 closed 1 year ago
@musictopia2 thanks for contacting us.
Does extending ComponentBase there solve the issue for you?
https://github.com/musictopia2/FailPublishSample/blob/7ae3231fd953b296f4390ec670fdaee2ccc90711/Start.razor.cs#L2
I can tell you for sure that extending componentbase does not solve the problem. The first thing I tried was to inherit from my component and still same thing. For example, if I inherit from the Start and override the OnInitialized, then same issue when publishing.
I see the same issue. Will this be sorted anytime soon?
Thanks for reporting, this is interesting, I'm able to repro as well. If you have OnInitialized
within a @code
block in the .razor
file, everything works as expected. It's only when it's moved to a code behind file do you get the error.
Also, the app works fine in debug mode as well as Portable
+ Framework Dependent
.
Non-Portable
deployments (self contained or framework dependent) result in the error.
This reproduces on both folder and Click Once targets (as long as it's not a Portable
deployment).
Marking this as a bug, and removing the investigate label.
Forked the repro, minimalized the app further, and added publish profiles: https://github.com/tanayparikh/FailPublishSample/tree/taparik/simplifiedRepro
Hi @musictopia2. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Verified this issue with Visual Studio Enterprise 17.8.0 Preview 1.0. Not repro on windows platform with sample project. FailPublishSample-master.zip
Description
Here is my repository that duplicates the bug. https://github.com/musictopia2/FailPublishSample If you do publish and choose self contained, then the problem always happens.
Steps to Reproduce
Follow the steps to create a wpf project and use the component. Then create a razor file. Then use option to do code behind. In the code behind, override OnInitialized. Then when you publish, publish to folder. Choose Self Contained. Then publish. The problem will always happen.
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows
Did you find any workaround?
The only workaround I found is to choose Framework Dependent and choose portable. This means if the computer being deployed on does not have .net core on their computers then does not work. Also, for now, requires portable to be chosen. I hope this problem gets fixed. The only other workaround is all razor files would have to be in a razor class library which can be an overkill if its only used from wpf.
Relevant log output