-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 errors frequently do not reference the file with an issue #21038
Comments
Reading the error message it specifies exactly where the error is: line 14, position 81 @mgoertz-msft is there something to be done on our side to also make the double-click work so people will go to the right position immediately or is that in VS? |
@jfversluis All XAML IntelliSense errors are prefixed with |
It claims the error is in the .csproj file. It gives no indication of which file actually contains the error. |
There column with that info does seem to have more text as it's ending in ... if you expand the column, is the right file in there? |
That column is expanded, as you can see in the screenshot. If I copy the full error from VS using "right-click + copy", I get this:
|
@mgoertz-msft could you help here ? The problem is at this line (I suspect) var location = projItem.RelativePath is not null ? Location.Create(projItem.RelativePath, new TextSpan(), new LinePositionSpan()) : null; RelativePath isn't null as a location is returned (position) but is probably string.Empty |
@StephaneDelcroix Those values come from here: fileOptions.TryGetValue("build_metadata.additionalfiles.TargetPath", out var targetPath);
fileOptions.TryGetValue("build_metadata.additionalfiles.ManifestResourceName", out var manifestResourceName);
fileOptions.TryGetValue("build_metadata.additionalfiles.RelativePath", out var relativePath);
fileOptions.TryGetValue("build_property.targetframework", out var targetFramework);
return new ProjectItem(additionalText, targetPath: targetPath, relativePath: relativePath, manifestResourceName: manifestResourceName, kind: kind, targetFramework: targetFramework); If the values aren't right, then that's either not the correct way to retrieve them or there's a bug in Roslyn that doesn't populate those values as expected. Another question would be if this happens for all MAUI XAML files or just some? And if it's the latter then what's different about those? |
Description
See title. Sometimes when there's an error with an XAML file, Visual Studio is unable to tell me which file/line the problem occurs in.
I never had this issue with Xamarin Forms, but in one week of Maui it's happened multiple times.
Steps to Reproduce
I'm not sure if this will reproduce the issue, but with the latest instance, I accidentally added the
Spacing
attribute to aStackLayout
twiceThe error in the error list opened up the .csproj file, rather than the file containing the error.
Link to public reproduction project repository
No response
Version with bug
8.0.3 GA
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: