Skip to content
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

Fixed UnobservedTaskException #111

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions MetroLog.Shared/Internal/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Logger : ILogger, ILoggerAsync, ILoggerQuery
public string Name { get; private set; }
readonly LoggingConfiguration _configuration;

static readonly Task<LogWriteOperation[]> EmptyOperations = Task.FromResult(new LogWriteOperation[] { });
static readonly LogWriteOperation[] EmptyOperations = new LogWriteOperation[] { };

public Logger(string name, LoggingConfiguration config)
{
Expand Down Expand Up @@ -93,7 +93,7 @@ internal Task<LogWriteOperation[]> LogAsync(LogLevel logLevel, string message, p
return LogInternal(logLevel, message, ps, null, true);
}

Task<LogWriteOperation[]> LogInternal(LogLevel level, string message, object[] ps, Exception ex, bool doFormat)
async Task<LogWriteOperation[]> LogInternal(LogLevel level, string message, object[] ps, Exception ex, bool doFormat)
{
try
{
Expand All @@ -118,7 +118,7 @@ Task<LogWriteOperation[]> LogInternal(LogLevel level, string message, object[] p
select target.WriteAsync(context, entry);

// group...
var group = Task.WhenAll(writeTasks);
var group = await Task.WhenAll(writeTasks).ConfigureAwait(false);
return group;
}
catch (Exception logEx)
Expand Down