Invalid program with specific method
This method lead to an "Invalid program" exception during runtime. Removing "DisplayWaitCursor" attribute fixes the problem This should be tried to reproduce.
[DisplayWaitCursor]
private async Task Add(InvoiceContactViewModel contactViewModel)
{
if (contactViewModel == null)
return; if (ChosenContactViewModels.Contains(contactViewModel))
return; if (ShowOnlyContactsWithoutIncidents)
{
var hasContactIncident = await HasContactIncident(contactViewModel); if (hasContactIncident)
{
_show.Error(
MultipleContactSelectionDialogResources.AssignContactToCorporationHint,
contactViewModel.Contact.AdvancedEntityText); return;
}
} var removeItem = AvailableContactViewModels
.SingleOrDefault(x => x.Contact.ID == contactViewModel.Contact.ID); ChosenContactViewModels.Add(contactViewModel); if (removeItem != null)
AvailableContactViewModels.Remove(removeItem);
}
Without the additional code, it is impossible to reproduce the error from your example.
That said, this looks like it matches the pattern of a method ending in a code block (if (removeItem != null) { AvailableContactViewModels.Remove(removeItem); }) related to issue #66. A simple work around is to simply add another line of code after the block. (for example, end the method with await Task.CompletedTask;)
I'm currently researching a better solution.
I believe this issue to be resolved in PR #100.