Skip to content

Commit

Permalink
throw for EventInvokerNames contained no items
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Apr 9, 2018
1 parent c621d60 commit 689c7b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>2.4.1</Version>
<Version>2.5.0</Version>
<LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>
</Project>
15 changes: 12 additions & 3 deletions PropertyChanged.Fody/EventInvokerNameResolver.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Fody;

public partial class ModuleWeaver
{
Expand All @@ -18,10 +19,18 @@ public partial class ModuleWeaver
public void ResolveEventInvokerName()
{
var eventInvokerAttribute = Config?.Attributes("EventInvokerNames").FirstOrDefault();
if (eventInvokerAttribute != null)
if (eventInvokerAttribute == null)
{
EventInvokerNames.Clear();
EventInvokerNames.AddRange(eventInvokerAttribute.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(x => x.Length > 0));
return;
}

EventInvokerNames = eventInvokerAttribute.Value.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries)
.Select(x => x.Trim())
.Where(x => x.Length > 0)
.ToList();
if (!EventInvokerNames.Any())
{
throw new WeavingException("EventInvokerNames contained no items.");
}
}
}

0 comments on commit 689c7b2

Please sign in to comment.