Browse Source

Adjust transformers and comments

Max Katz 2 years ago
parent
commit
28d7c1c3bd

+ 1 - 0
samples/Sandbox/Sandbox.csproj

@@ -5,6 +5,7 @@
     <TargetFramework>net6.0</TargetFramework>
     <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
     <IncludeAvaloniaGenerators>true</IncludeAvaloniaGenerators>
+<!--    <AvaloniaXamlIlDebuggerLaunch>true</AvaloniaXamlIlDebuggerLaunch>-->
   </PropertyGroup>
 
   <ItemGroup>

+ 1 - 1
src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs

@@ -304,7 +304,7 @@ namespace Avalonia.Build.Tasks
                                      || "Internal".Equals(classModifierText, StringComparison.OrdinalIgnoreCase))
                                 classModifierPublic = false;
                             else
-                                throw new XamlParseException("Invalid value for x:ClassModifier. Expected value are: Public, NotPublic.", precompileDirective);
+                                throw new XamlParseException("Invalid value for x:ClassModifier. Expected value are: Public, NotPublic (internal).", precompileDirective);
                         }
                         
                         var classDirective = initialRoot.Children.OfType<XamlAstXmlDirective>()

+ 2 - 2
src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/GroupTransformers/XamlIncludeGroupTransformer.cs

@@ -108,7 +108,7 @@ internal class AvaloniaXamlIncludeTransformer : IXamlAstGroupTransformer
         }
 
         var relativeName = "Build:" + assetPath.Substring(assemblyNameSeparator);
-        var buildMethod = avaResType.FindMethod(m => m.Name == relativeName);
+        var buildMethod = avaResType.FindMethod(m => m.Name == relativeName && m.IsPublic);
         if (buildMethod is not null)
         {
             return FromMethod(context, buildMethod, sourceUriNode, expectedLoadedType, node, assetPathUri, assembly, additionalProperties);
@@ -119,7 +119,7 @@ internal class AvaloniaXamlIncludeTransformer : IXamlAstGroupTransformer
         }
 
         return context.ParseError(
-            $"Unable to resolve XAML resource \"{assetPathUri}\" in the \"{assembly}\" assembly.",
+            $"Unable to resolve XAML resource \"{assetPathUri}\" in the \"{assembly}\" assembly. Make sure this file exists and is public.",
             sourceUriNode, node);
     }