NLog: NLog randomly crashes in UWP app with Microsoft.Extensions.DependencyInjection (only when debugging)
NLog version: 4.6.7
Platform: UWP: Windows 10, version 1809(10.0; Build 17763) - Windows 10, version 1903(10.0; Build 18362) Console: .NET Core 2.2
Current NLog config (xml or C#, if relevant)
public static void AddLogger(this ServiceCollection services)
{
services.AddLogging(loggingBuilder =>
{
// configure Logging with NLog
loggingBuilder.ClearProviders();
loggingBuilder.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
loggingBuilder.AddNLog();
});
// UWP is very restrictive of where you can save files on the disk.
// The preferred place to do that is app's local folder.
StorageFolder folder = ApplicationData.Current.LocalFolder;
string fullPath = folder.Path + @"\Logs\${date:format=yyyy-MM-dd}.Player.log";
var config = new LoggingConfiguration();
var fileTarget = new FileTarget("App.log")
{
FileName = fullPath,
Layout = "${longdate} ${uppercase:${level}} ${message} ${exception}"
};
config.AddTarget(fileTarget);
config.AddRule(NLog.LogLevel.Debug, NLog.LogLevel.Fatal, "App.log");
LogManager.Configuration = config;
}
- What is the current result?
Sometimes it’s working. But sometimes UWP app is crashing. So random crash. With no trace, but I know it’s because of nlog.
- What is the expected result? Stable working app.
- Did you checked the Internal log? No.
- Please post full exception details (message, stacktrace, inner exceptions) I’ve created a minimal reproducible example here: https://github.com/aosyatnik/UWP_with_nLog
- Are there any workarounds? yes/no I don’t know.
- Is there a version in which it did work? I don’t think so.
- Can you help us by writing an unit test? Maybe.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (12 by maintainers)
I’ll ask on microsoft side: https://developercommunity.visualstudio.com/content/problem/773519/random-systemexecutionengineexception-in-uwp-on-st.html
Thanks for helping 😃
So there is no logging enabled or whatsoever and it still crashes (sometimes)
error details until now:
it’s always 0x80131506
maybe related: https://developercommunity.visualstudio.com/content/problem/25274/systemexecutionengineexception-when-debugging.html