Open Gdocal opened 6 years ago
Thanks, let me take a look and try to reproduce.
Are you able to reproduce with the ReflectInsight NLog sample?
yes, but let me clarify, these errors doesn't throws up to caller code. I just noticed issue in ReflectInsight Live Viewer and in VS output. In viewer instead of seeing expected data I seeing "Internal Exception:
So to see more information about errors I enabled 'Break When Throw' in VS (Exception settings) for NullReferenceException and SecurityException exceptions.
Thanks for clarification. What version of ReflectInsight viewer are you using?
I'm not seeing the same issue. I'm running the above code inside the ReflectInsight NLog sample app and I updated to the same NuGet package versions listed above:
Can you provide me a screenshot, which version of Visual Studio and ReflectInsight you're using.
hm. VS 2015 Live Viewer 5.7.0
ok here is my Config files App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="insightSettings" type="ReflectSoftware.Insight.ConfigurationHandler,ReflectSoftware.Insight" />
<!--<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />-->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ReflectSoftware.Insight" publicKeyToken="c78ddbdaf1f32b08" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.7.1.1706" newVersion="5.7.1.1706" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="PostSharp" publicKeyToken="b13fd38b8f9c99d7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.44.0" newVersion="5.0.44.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<insightSettings>
<baseSettings>
<configChange enabled="true" />
<propagateException enabled="false" />
<exceptionEventTracker time="20" />
<debugMessageProcess enabled="true" />
</baseSettings>
<listenerGroups active="Debug">
<group name="Debug" enabled="true" maskIdentities="false">
<destinations>
<destination name="Viewer" enabled="true" filter="" details="Viewer" />
</destinations>
</group>
</listenerGroups>
<logManager>
<instance name="nlogInstance1" category="NLog" />
<instance name="fields" />
<instance name="General" category="General" />
<instance name="serviceClass" category="ServiceLayer" />
<instance name="businessClass" category="BusinessLayer" />
<instance name="dataAccessClass" category="DataAccessLayer" />
</logManager>
<extensions>
<extension name="tracer.fields" instance="fields" />
<extension name="tracer.General" instance="General" properties="MethodName|Parameters" />
<extension name="tracer.service" instance="serviceClass" properties="MethodName" />
<extension name="tracer.business" instance="businessClass" properties="Parameters" />
<extension name="tracer.dataAccess" instance="dataAccessClass" properties="HashedParameters" />
</extensions>
</insightSettings>
</configuration>
NLog.config
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- In order to recieve location information, you must ensure the layout has the parameter ${callsite} and all its properties set accordantly. -->
<extensions>
<add assembly="ReflectSoftware.Insight.Extensions.NLog"/>
</extensions>
<targets>
<target name="ReflectInsight"
xsi:type="ReflectInsight"
instanceName="nlogInstance1"
displayLevel="true"
displayLocation="true"
layout="${callsite:className=true:fileName=true:includeSourcePath=true:methodName=true}" />
<target name="Console" xsi:type="Console" layout="${message}"/>
</targets>
<rules>
<logger name="*" minlevel="TRACE" writeTo="ReflectInsight" />
<logger name="*" minlevel="TRACE" writeTo="Console" />
</rules>
</nlog>
I don't know why exception didn't appear in output window. Maybe because I use 'Break When Throw' option
Thanks, ok let me work with this.
I quickly just noticed in your app.config the NLog section is commented out. Could be culprit.
When I get home I'll debug with your configs and see whats up.
Thanks. Code works fine everywhere in my project. I noticed issue only in one function which use dynamic variable. So probably it is something specific to dynamic
No luck. I've modified the sample NLog application with your code and configuration and ran it on another machine which has VS 2015 and ReflectInsight Viewer 5.7.0. App runs and logs without issues.
Thanks Callon
Exception thrown: 'System.NullReferenceException' in ReflectSoftware.Insight.Extensions.NLog.dll at ReflectSoftware.Insight.Extensions.NLog.NLogTarget.SendMessage(ActiveStates states, MessageType mType, LogEventInfo logEvent) and after this exception another exception occur: Exception thrown: 'System.Security.SecurityException' in mscorlib.dll Additional information: Requested registry access is not allowed.
Code to reproduce:
Libraries used: Nlog 4.4.12 Newtonsoft.Json 10.0.0.3 ReflectSoftware.Insight.Extensions.NLog 5.7.1