Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[X] find xmlns in Core at design time #11121

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .nuspec/Xamarin.Forms.targets
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
Inputs="@(_XamlGInputs)"
Outputs="@(_XamlGOutputs)">
<PropertyGroup>
<ReferencedAssemblies Condition="'$(_ReferencedAssemblies)'==''">@(ReferencePath)</ReferencedAssemblies>
<ReferencedAssemblies Condition="'$(_ReferencedAssemblies)'!=''">$(_ReferencedAssemblies)</ReferencedAssemblies>
<ReferencedAssemblies>@(ReferencePath)</ReferencedAssemblies>
</PropertyGroup>
<XamlGTask
XamlFiles="@(_XamlGInputs)"
Expand Down
12 changes: 6 additions & 6 deletions Xamarin.Forms.Build.Tasks/XamlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ void GatherXmlnsDefinitionAttributes()
_xmlnsDefinitions = new List<XmlnsDefinitionAttribute>();
_xmlnsModules = new Dictionary<string, ModuleDefinition>();

if (string.IsNullOrEmpty(References))
return;

string[] paths = References.Split(';').Distinct().ToArray();
var paths = References?.Split(';').Distinct().ToList() ?? new List<string>();
//Load xmlnsdef from Core and Xaml
paths.Add(typeof(Label).Assembly.Location);
paths.Add(typeof(Xamarin.Forms.Xaml.Extensions).Assembly.Location);

foreach (var path in paths) {
string asmName = IOPath.GetFileName(path);
Expand Down Expand Up @@ -430,9 +430,9 @@ CodeTypeReference GetCustomNamespaceUrlType(XmlType xmlType)
null,
(typeInfo) =>
{
ModuleDefinition module = null;
if (typeInfo.AssemblyName == null || !_xmlnsModules.TryGetValue(typeInfo.AssemblyName, out module))
if (typeInfo.AssemblyName == null || !_xmlnsModules.TryGetValue(typeInfo.AssemblyName, out ModuleDefinition module))
return null;

string typeName = typeInfo.TypeName.Replace('+', '/'); //Nested types
string fullName = $"{typeInfo.ClrNamespace}.{typeInfo.TypeName}";
return module.Types.Where(t => t.FullName == fullName).FirstOrDefault();
Expand Down
5 changes: 0 additions & 5 deletions Xamarin.Forms.Xaml.UnitTests/MSBuild/MSBuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ XElement NewProject (bool sdkStyle)
propertyGroup.Add (NewElement ("TargetFrameworkVersion").WithValue ("v4.7"));
propertyGroup.Add(NewElement("RootNamespace").WithValue("test"));
}
var refpath = string.Join(";",
IOPath.Combine("..", "..", "Xamarin.Forms.Core.dll"),
IOPath.Combine("..", "..", "Xamarin.Forms.Xaml.dll"));
propertyGroup.Add(NewElement("_ReferencedAssemblies").WithValue($"{refpath}"));

propertyGroup.Add(NewElement("_XFBuildTasksLocation").WithValue($"{testDirectory}\\"));


Expand Down