MaciekLesiczka / netric

netric core sources
Apache License 2.0
13 stars 2 forks source link

NullReferenceException on a sharepoint 2013 #5

Open ibobak opened 8 years ago

ibobak commented 8 years ago

I've launched

apman -i "SharePoint - 80" apman.exe -asm Microsoft iisreset

(I mistakenly put Microsoft instead of Microsoft*, but I think it doesn't matter).

After trying to access a sharepoint page (sharepoint 2013) http://myserver/sites/bidw/Documents/Forms/AllItems.aspx

I am getting this exception (also put to see the error):

Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.] Netric.Intercept.Clr.Interceptor.OnEnter(String method) +76 Microsoft.Diagnostics.Tracing.EventSource..ctor(EventSourceSettings settings, String[] traits) +70 Netric.Intercept.Clr.ClrEventSource..ctor() +16 Netric.Intercept.Clr.ClrEventSource..cctor() +27

[TypeInitializationException: The type initializer for 'Netric.Intercept.Clr.ClrEventSource' threw an exception.] Microsoft.Build.Utilities.ToolLocationHelper.GetSupportedTargetFrameworks() +111 System.Web.Compilation.MultiTargetingUtil.InitializeKnownAndLatestFrameworkNames() +28 System.Web.Compilation.MultiTargetingUtil.EnsureFrameworkNamesInitialized() +237 System.Web.Compilation.BuildManager.Initialize() +243 System.Web.Compilation.BuildManager.InitializeBuildManager() +307 System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +890

[HttpException (0x80004005): The type initializer for 'Netric.Intercept.Clr.ClrEventSource' threw an exception.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +626 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +669

ibobak commented 8 years ago

I changed the code like this

private static ClrEventSource _Log;

    private ClrEventSource() { }

    public static ClrEventSource Log
    {
        get 
        {
            if (_Log == null)
            {
                _Log = new ClrEventSource();
            }
            return _Log;
        }
    }

and the problem disappeared. However, there appeared another problem: w3wp.exe just fails with no meaningful exception (Visual Studio Debugging is offered).

I was working on a dev server, therefore I coundn't work for a long time there. On my PC a web app was working fine. On the dev server I got the SysInternals Process Monitor trace with RESULT!=SUCCESS. It shows which files and registry entries the w3wp.exe tried to access and the reason of failure.

I don't know why it is not attachable here - please contact with me in skype (login=ibobak), I will help you to debug it as much as I can.

Thanks in advance.

MaciekLesiczka commented 8 years ago

@ibobak Have you tried instrumentation with any other assemblies? Do you have any other software for profiling/monitoring installed on your server? What is the architecture of w3wp? - x64/x86?

ibobak commented 8 years ago

No, I did not use any other instrumentation, and no other assemblies of this kind were not used at all. Also there are no other software for profiling.

This is x64 server with Windows 2012R2