-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Xaml Markup Elements) switch issue level for xaml related methods to warning for first build or after added new element which hasnt be build till then #2617
Comments
Thanks for the report. I'm not too sure what the issues are. Could you provide repro steps that explain the behavior that you think is incorrect or could be improved? |
@jeromelaban its kind of a known issue (see link I provided which is showing the same "InitializeComponent() is not known maybe missing reference" Problem. I did speak about that with @mikernet who do have some more experience than me in dev things. Did that answer your question? Other Questions to the other points? |
@jeromelaban I think the issues being referred to here are:
|
Thanks @DevTKSS, it does.
This is a good idea indeed, though I don't think VS will allow to filter templates and both the XAML and markup ones would appear at the same time. Let's track in unoplatform/uno#18690.
This is generally a WinUI problem, as uno uses code generators that take effect almost instantly. Do you see it still happening if |
@jeromelaban Sorry for not answering your last question, actually I did not noticed your replyed information in my inbox. At the moment, I can not provide a example repo where the InitializeComponent() Issue is present, just that it is most of the time happening on not build projects or on files which are newly added to the project, so also not build > Background generators not runned, and I will have a look, if it happens again, if it is also on projects without the windows target like you said. |
What would you like to be added
See Edit Note in reasoning, there seem to be a fix for wpf solutions you might could replicate for fixing? Else: Add a "first time" marker to xaml using elements in project file or other codebehind for the compiler, that disables errors/issues coming from unrecognized e.g. InitializeComponent() Methods caused xaml at/after build/compilation or alternativly set them for before first build to just warning if possible
Add a c#-Markup using ContentDialog Template to the chooseable Templatelist which visual studio uses on Add>New Item
If it is possible to influence the generator of the csproj file, please add the capability to it to first look up the named itemgroups & items in it and maybe make it more sorted?
If the named path/file is not longer existing, it should not add duplicates of them, else if it is not exsisting (mostly relevant in pre release state), just let it delete the item group thats not longer needed.
Why is this needed
[Added Edit Note:] Researching for existing workarounds of other Developers in internet for the curious case of the duplicate Pages Warning, I found this report which is quite matching to the behaviour (including screenshots and comments of many users) I expirienced with point 1 of my list. https://developercommunity.visualstudio.com/t/Second-time-reporting:-WPF:-C-Editor-ca/10532548
In the middle of the quite neverending story there it seems to be fixed, but if you scroll to the end (August 2024!), where the problem in WPF Applications seems to be fixed, they are explicit mentioning UNO and MAUI applications:
In case you created a application with c# Markup and decide to need a ContentDialog, you would normally do this in visual studio:
Folder/Solution>RightClick>Add>New Item
this will prompt you the template manager to choose a template from the list and set its name.
Because all uno templates are listed as c# Elements the estimation would be, to get a cs file like e.g. MainPage with its MainModel like the rest of the solution structure.
But what it will give you is a ContentDialog.xaml and under this a ContentDialog.xaml.cs so someone who was happy to just have to learn c# to develop a uno application, will have to learn xaml additional and be promted the mentioned issue from 1.
Behaviour of duplication good described here (for WPF)
https://developercommunity.visualstudio.com/t/duplicated-xaml-file/119138
But additionally it is telling me on my device, that the ContentDialog file is already existing. I think that is caused by the naming:
ContentDialog1.xaml
ContentDialog1.xaml.cs
seems like it is thinking the one with .cs ending is duplicate of the xaml only...
For which platform
WebAssembly, Android, iOS, Mac Catalyst, Skia (WPF), Skia (Linux X11), Skia (macOS), Skia (Linux Framebuffer), Skia (GTK), Windows (WinAppSDK)
Anything else we need to know?
Additional (I do not know were this would belong correctly):
Could you add a kind of automatism for the time inbetween, while we have to add xaml files to a c# markup application, that disables the possibility to add a ContentDialog templated file into the Presentation folder?
I already had a few times the issue, that the dublicated page warning throws me a issue because of this, so please take a look into that, so editing the csproj file to clean up not longer existing paths/files manually would not longer needed.
Workarounds?
copy from the mentioned forum above of one of the posts, giving a quite goot summ up of possible (not tryed out) workaround:
The text was updated successfully, but these errors were encountered: