Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all 1710 articles
Browse latest View live

Obtaining debug symbol (PDB) files for .NET Framework 4.5.2

$
0
0

Hello,

It seems that Microsoft forgot to publish the debug symbol files for the .NET Framework binaries distributed with the .NET 4.5.2 update.

For example, the following diagnostic message is printed by windbg/symchk when attempting to download the symbols for x64 clr.dll, version 4.0.30319.34209, distributed with the .NET 4.5.2 update (when the update is installed on Windows Server 2008 R2 SP1):

SYMSRV:  http://msdl.microsoft.com/download/symbols/clr.pdb/E3E0C76A7909454FB3C56B0C2CE5FFEB2/clr.pdb not found
DBGHELP: clr - no symbols loaded

As a result, diagnostic tools (such as SOS.dll debugger extension, profilers, etc.) fail to work correctly.

It is already over 50 days since the release - and these CLR builds are starting to pop up in customer installations.
Is there any other way to obtain the PDB files?

Thank you.


Securely Saving Windows Auto Logon Password in .NET

$
0
0

I'm trying to securely store a password for autologon in Windows through .NET.  There are lots of examples out there about how to securely store the password in C++ or about how to *insecurely* store the password in .NET.  But I can't find any examples that do it securely in .NET.

Here's the article that explains how to do this insecurely:
http://msdn.microsoft.com/en-us/library/aa378750(v=VS.85).aspx

And in it there's a link to how to do it securely using C++:
http://msdn.microsoft.com/en-us/library/aa378826(v=VS.85).aspx

I've found that supposedly System.Security.Cryptography.ProtectedData can be used to replace the call to LsaStorePriveData, but I can't figure out what to do with the encrypted password... where to store it, etc.

I hope that the fact that this question land squarely between the Windows and .NET forums won't cause it to fall through the cracks... I really don't want to have to just write the plaintext password to the registry (insecure), which is my only alternative without some help...

TIA.

CLR Crashes with exception code Exception code: 0xc0000409 while performing DoStackSnapshot

$
0
0

We develop a .NET application profiling tool and use the Profiling API heavily.

We perform stackwalks using DoStackSnapshot API as described in https://msdn.microsoft.com/en-us/library/bb264782.aspx

We have a 2 separate crash dump instances which show that the CLR crashes while executing the DoStackSnapshot() API.

The crash dump shows the following frames.
 clr.dll!__report_gsfailure() Unknown
  clr.dll!CrawlFrame::CheckGSCookies(void) Unknown
  clr.dll!StackFrameIterator::PreProcessingForManagedFrames() Unknown
  clr.dll!StackFrameIterator::NextRaw(void) Unknown
  clr.dll!Thread::StackWalkFramesEx() Unknown
  clr.dll!Thread::StackWalkFrames() Unknown
  clr.dll!ProfToEEInterfaceImpl::DoStackSnapshotHelper(class Thread *,struct _PROFILER_STACK_WALK_DATA *,unsigned int,struct _CONTEXT *) Unknown
  clr.dll!ProfToEEInterfaceImpl::DoStackSnapshot(unsigned __int64,long (*)(unsigned __int64,unsigned __int64,unsigned __int64,unsigned int,unsigned char * const,void *),unsigned int,void *,unsigned char *,unsigned int) Unknown
  HP.Profiler.dll!0000000180034f33() Unknown
  HP.Profiler.dll!000000018003446b() Unknown
  HP.Profiler.dll!000000018000d3a4() Unknown
  HP.Profiler.dll!000000018000a8f8() Unknown
  kernel32.dll!BaseThreadInitThunk() Unknown
  ntdll.dll!RtlUserThreadStart() Unknown

Brief snippet of the code

CONTEXT context;
memset(&context, 0, sizeof(context));
context.ContextFlags = CONTEXT_FULL;

if(GetThreadContext(threadHandle, &context))
{

swClientDataStruct clientData;
hr = pProfilerInfo->DoStackSnapshot(tId, StackWalkCallback, COR_PRF_SNAPSHOT_REGISTER_CONTEXT, (void *)&clientData, (BYTE*)&context, sizeof(context));
}
This code path is used in many other scenarios and works just fine. We just have some instances where we see this problem.

Can anybody from the Microsoft CLR profiler API team help in trying to explain the cause of the crash and how this can be avoided ?

From my research on the web(http://dotnetbeyond.blogspot.com/2010_02_01_archive.html), it seems to indicate that the GSCookie gets corrupted when the called native code may overrun the buffer. Why does this get evaluated during a stackwalk ? Does it mean this thread would have crashed as it unwound the stack on execution ?

Regards and thanks for any responses

Sanjay


Sanjay Mehta

How to avoid copying the reference in linq C#

$
0
0

Hi All,

I have following queries - 

  currObject = (from obj in objectEntity.parts
                       where obj.pKey.Equals(cKey)
                       select obj).FirstOrDefault();

  newObject = (from obj in objectEntity.parts
                       where obj.pKey.Equals(cKey)
                       select obj).FirstOrDefault();

 Here both above linqs are same. If I used -

 newObject = currObject

 It will copy the reference which I don't want. I want both the object independent on each other using 1 query.

Please help me.


Unable to install application with Oracle 9i access dll in clinet machines

$
0
0

Hi,

I built a small application which gets input from user and update to Oracle remoter server (Oracle 9i).  I included Oracle.DataAccess.dll in my project's reference. Now, I am able to build it successfully and install in my machine (same as the development system).

But when I install the same program in other machines and <g class="gr_ gr_21 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="21" id="21">lauch</g>, following error message is thrown

"Unable to loadDLL 'OraOps9.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

Any possible resolutions?


Thanks,

Sabari


C# .Net Native Lockup on GCSettings.LatencyMode = GCLatencyMode.LowLatency;

$
0
0

So app is locking up on calling this when the app is compiled to .Net Native. It works great in non .Net Native compilations.

GCSettings.LatencyMode =GCLatencyMode.LowLatency;

Why would this be happening? I need the LowLatency setting. Thanks in advance.


SB Software Developer

Using Impersonation for HttpWebRequest

$
0
0

I'm trying to call a web service using Impersonation. When I do the request with ImpersonationLevel set, I get a 401 Unauthorized exception thrown at GetResponse. When I do it without impersonation (thereby making the request using the server service account), I to get a response and no exceptions thrown.

My goal is to use Impersonation so that I can make the web service call using the client's credentials via kerberos. The web service does authenticate the client when they make direct connections (to the service URI). But why this 401 is being thrown? Perhaps something is missing in the AD setup?

                WindowsImpersonationContext context = identity.Impersonate();
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
                req.ImpersonationLevel = TokenImpersonationLevel.Delegation;
                req.UseDefaultCredentials = true;
                req.AllowAutoRedirect = false;
                req.Timeout = 30000;
                HttpWebResponse response = (HttpWebResponse) req.GetResponse();


Software Engineer

Double Icons in My Documents all folders

$
0
0

I just upgrade my windows from 8.1 to windows 10 insider preview.

   all of the default folders of my documents are double why??????

 


Why GC collection counters decrement at some points in w3wp.exe???

$
0
0

I measured the Gen/0/Gen1/Gen2 collection counters on an instance of w3wp.exe and noticed that these counters decrease at some points. I would expect that by being accumulative counters they would never decrease for a single process. I had multiple instances of w3wp running on this machine and I monitored only one of them (like w3wp.exe/#5) which I knew was the one I was interested in. I monitored for about 3 hours and I know that during these 3 hours the process didn't recycle. What could explain this?

Thanks

How approaches of the GC works?

$
0
0

Hi,

I have gone through the GC. I am unable to grab the contents in MSDN. I have referred some sites.
Finally, I have little confusion and queries.

Could some one tell that, my understanding is correct?

What I understood is:

As shown above,the heap will be divided into 3 small heaps(Gen 0,1,2)
and each of them will grow or shrink in size, according to the need.

Inside each heap, there will be two region named, small object heap and large object heap.
Of them the first 2 gen's are ephemeral(lasting for very small time - as synonym says).

Clean-up  Approaches:-

1. Concurrent Garbage Collector:-
It will follow the "stop world" concept for the gen 0 and gen 1,since a small pause to the UI thread(who require the small space), will not make a big deal.  
(A)"Question:" Is it a thread or normal function which will do this block mechanisms.?
A separate thread will do the cleaning for the gen-2 and if any needed situation arises, it will block the UI thread when it requires a big space.
And gen2's GC thread will run parallel to the UI thread, when there is a need for the garbage collection. That's why it is named as Concurrent.
(B)Question:- These two garbage collection(G0,G1 and G2) process/threads will work parallel?

2. Background Garbage Collector:-
The ephemeral gen's are cleared by a separate thread (Foreground garbage collector thread and as usual it will block the UI thread if no enough space) and gen2 is cleared byseperate thread(C).
And 2nd gen GC thread will pause and resume, based upon the state of the Foreground thread.

(C)Question:- Is this thread will not perform the blocking call to the UI thread when some one requires a bulk space?
(My Thinking and Query:- It will not block, as the name suggest, it will run in the background.
But what if some one requires a large space and that space is not avail?. What approach it will follow?)

Since it is a single concept, i have asked questions, instead of a seperate thread.

Thanks in advance.


NANDAKUMAR.T

Unmanaged C++ calls managed c++ : it crashes on windows xp

$
0
0

Hi,

if I call a c++ function in a managed DLL from an unmanaged dll or exe, it crashes on Windows xp, but it runs fine on Windows 7.

On Windows XP I get an error message:

Die Anwendung konnte nicht richtig initialisiert werden (0xc0000135).

The Code is very simple. The Header file:

#pragma once


#ifdef _CLR_DLL_
#define _EXPORT_ __declspec( dllexport )
#else
#define _EXPORT_ __declspec( dllimport )
#endifextern"C"
{int _EXPORT_ func(int i);
}

The c++ file:

#include "stdafx.h"

#include "ClrDll.h"int func(int i)
{return i;
}

It is compiled with the /clr switch.

The caller is a simple C++ program, it calls this function.

I use Visual Studio 2010, and .NET framework 4.0

It works fine on windows 7.

It is very important for me this project to run on Windows XP.

I can send a whole project, it is very small.

Is there a wrong setting in VIsual Studio, or it is a bug in Windows XP? Can I make a workaround?

UriFormatException was unhandled

$
0
0

I have a class named HttpRequestHelper.cs that establish Http client request to the service.  Inside this class, I have a method that will create response Http object.  The error is encountered in var response = client.GetAsync(methodUrl).Result, it throws a run-time exception of UriFormatException was unhandled, with Additional Information: Invalid URI: Invalid port specified

The value of methodUrlis Cart/CreateCart/72ae1432-e988-44f5-9fc9-7af9c2d0c704/C/0020010000001

In my App.config file, I have setup appSettings and added a key <add key="someAPIURL" value="https://xxx.xxx.xxx.xxx:8080 " />

I really appreciate of any help or inputs.

Getting class objects using ICoreprofiler

$
0
0

Hi, 

I am trying to get the parent class object of the called function using ICoreprofilerCallback/ICoreprofilerInfo2 APIs.

What i want to do is

So my parent class

public class TestManagedClass{

public int somevalue;

public SecondDotNetClass cls;

......

public void MyFunction(some args);

}

I am using ICoreprofiler and getting the call back when the the function 'MyFunction' being called with functionId,clientdata,frameinfo and argument info.

Once i am here, i call GetFunctionInfo2 and get the class id. Now what i want to do is get this information and pass it on to the manged layer and pass some kind of pointer there so that i can do something like this.

IntPtr p = (IntPtr)Ptr;
        GCHandle handle2 = (GCHandle)p;
        TestManagedClass objOfInterest= (handle2.Target as TestManagedClass);

I am looking at GetBoxClassLayout or GetClassLayout kind of methods so that i can extract the GCHandle or something similar to it, with which i can get the managed object back. Does any of these sound reasonable ? Or do i have to hook to some other call back so that i can map the class id to GCHandle? 

Thank in advance for your advice!


itsgPhere

Windows Application crashes due to CLR.dll - Windows 2008 R2 Server

$
0
0

Hello All,

I have a Dot Net Framework 4.0 based application developed on Visual Studio 2010 Professional which is running as a Windows Service on Windows Server 2008 R2 Enterprise Version with Service Pack 1, 64 bit Operating System.

The application seems to crash intermittently and the reason is as below :

Faulting Module name: clr.dll, version: 4.0.30319.1026

Exception Code: 0xc0000409

Fault Offset: 0x002b79d8

Faulting module path: C:\Widows\Microsoft.NET\Framework\v4.0.30319\clr.dll

Can you kindly let me know if there is any HOTFIX for this CLR.dll crash issue? If yes can you let me know regarding the same?

AverageTimer32 custom counter not visible in perfmon x64???

$
0
0

Hi,

I create a counter in my app, an AverageTimer32 counter type.

but the counter is only visible when I start the x32 version of the perfmon tool!!!!

how to create a timer counter  working in the x64 version of the perfmon?

like the disk sec / read counter which is also an AverageTimer32.

thanks.


Deadlock when starting up a WinForm application (advapi32!SddlSidLookupCritical and ntdll!LdrpLoaderLock)

$
0
0

Hi,

When we start our system we boot several managed WinForm applications. When we updated to .NET 4.0 we started noticing that more often than not - one random application would not start. You could see it in the task manager but no UI were visible. 

Running Debug Diagnostics Tool for a dump we got the following information.

Detected a serious critical section related problem in process.dmp
Lock at advapi32!SddlSidLookupCritical owned by thread 2 is Deadlocked with lock at ntdll!LdrpLoaderLock owned by thread 0

So there seems to be a deadlock, but we cannot really see where. Any suggestions on how we can move forward with debugging this issue?

Thread data below.

Thread 0 - System ID 944

This thread is not fully resolved and may or may not be a problem. Further analysis of these threads may be required.

.NET Call Stack
Function
[[DebuggerClassInitMarkFrame]]

Full Call Stack
Function
ntdll!KiFastSystemCallRet
ntdll!ZwWaitForSingleObject+c
ntdll!RtlpWaitForCriticalSection+132
ntdll!RtlEnterCriticalSection+46
advapi32!InitializeSidLookupTable+86
advapi32!LocalConvertStringSDToSD_Rev1+78
advapi32!ConvertStringSecurityDescriptorToSecurityDescriptorW+31
advapi32!ConvertStringSecurityDescriptorToSecurityDescriptorA+4c
msctf!CreateProperSecurityDescriptor+a6
msctf!CCicSecAttr::operator _SECURITY_ATTRIBUTES *+38
msctf!CCiceroSharedMem::Start+6c
msctf!ProcessAttach+17b
msctf!DllMain+39
msctf!_DllMainCRTStartup+52
ntdll!LdrpCallInitRoutine+14
ntdll!LdrpRunInitializeRoutines+344
ntdll!LdrpLoadDll+3e5
ntdll!LdrLoadDll+230
kernel32!LoadLibraryExW+18e
user32!GetGUIThreadInfo+12d
ntdll!KiUserCallbackDispatcher+13
user32!GetScrollInfo+3a7
user32!GetScrollInfo+460
user32!CreateWindowExW+33
ole32!InitMainThreadWnd+3c
ole32!CoInitializeEx+112
clr!Thread::SetApartment+16d
clr!SystemDomain::SetThreadAptState+90
clr!SystemDomain::ExecuteMainMethod+181
[[DebuggerClassInitMarkFrame]]
clr!ExecuteEXE+58
clr!_CorExeMainInternal+19f
clr!_CorExeMain+4e
mscoreei!_CorExeMain+38
mscoree!ShellShim__CorExeMain+99

mscoree!_CorExeMain_Exported+8

Thread 2 - System ID 7104

This thread is waiting on critical section ntdll!LdrpLoaderLock owned by thread 0.
Thread 0 in turn is deadlocked with another thread.


.NET Call Stack
Function

Full Call Stack
Function
ntdll!KiFastSystemCallRet
ntdll!ZwWaitForSingleObject+c
ntdll!RtlpWaitForCriticalSection+132
ntdll!RtlEnterCriticalSection+46
ntdll!LdrLockLoaderLock+ea
ntdll!LdrLoadDll+d6
kernel32!LoadLibraryExW+18e
kernel32!LoadLibraryW+11
rpcrt4!PerformRpcInitialization+e6
rpcrt4!RpcStringBindingComposeW+14
advapi32!RpcpBindRpc+19f
advapi32!PLSAPR_SERVER_NAME_bind+18
rpcrt4!GenericHandleMgr+a0
rpcrt4!ExplicitBindHandleMgr+44
rpcrt4!NdrClientCall2+d3
advapi32!LsarOpenPolicy2+1b
advapi32!LsaOpenPolicy+95
advapi32!InitializeSidLookupTable+ea
advapi32!LocalConvertStringSDToSD_Rev1+78
advapi32!ConvertStringSecurityDescriptorToSecurityDescriptorW+31
clr!ProfilingAPIAttachDetach::GetSecurityDescriptor+1c1
clr!ProfilingAPIAttachDetach::InitSecurityAttributes+13
clr!ProfilingAPIAttachDetach::InitializeForOnDemandMode+6a
clr!ProfilingAPIAttachDetach::GetAttachEvent+1c
clr!Thread::intermediateThreadProc+4b
kernel32!BaseThreadStart+37

Marshal Problem with a Big Text structure

$
0
0

Hi!

I have a Problem with a big TEXT Structure...

Here is te Problem....

Imports System.Runtime.InteropServices
Public Class VBMaxSizeClass

    Public WPFSehrLangerText As String


    <StructLayout(LayoutKind.Sequential)> Public Structure VBSATZ<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=3000000)> Public SehrLangerText As String

    End Structure

    Declare Function TESTCALL Lib "COBLangTest.dll" (ByRef VBSATZDATEN As VBSATZ) As Integer

    Public Sub TestCall()

        Dim CblStatus As Integer

        Dim VBSATZ001 = New VBSATZ

        VBSATZ001.SehrLangerText = WPFSehrLangerText

        CblStatus = TESTCALL(VBSATZ001)

        WPFSehrLangerText = VBSATZ001.SehrLangerText.Trim(" ")

    End Sub


End Class

The SizeConst:=3000000 is to BIG :-(

But i Need this size as a fix lenght for that i use "ByValTStr"...

Is there any other way to bring the text down into the SUB DLL?

Best Regards

Bernd

FIPS validated cryptographic algorithms

$
0
0

I have enabled the FIPS algorithm policy on our windows server2008 machine. Now, any page that has a viewstate is abending with the following error: 

This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.



This is used in a web farm so we have a machine key defined in our machine.config. If I add decryption="3DES" to the end of that key everything works again. My guess is the default is AES which isn't FIPS compliant. I also noticed this is not an issue on my iis 6.0 servers running server 2003. Very similar setup.

Is there a better way to handle this situation? I read some articles about doing something similar in the app web config. The web.config worked fine. However, the machine.config change seems better because I won't have to change every application.

 

Extract variable name from string in Visual C++

$
0
0

In my program, I have a struct similar to the following:

public struct switchStruct{char nextSwitch [7];
int randomNumber;
};

What I am trying to do is create a struct instance named currentSwitch for use in a while loop.  I would like the currentSwitch.nextSwitch to be able to point to the randomNumber field in the next switch.  The pseudocode would like the following:

(currentSwitch.nextSwitch).randomNumber

In other words, say the current switch is switchB, with a nextSwitch value of 'switchC'.  I want the code to be able to take 'switchC' and be able to retrieve the value of switchC.randomNumber.

Is this possible?  I am using Visual C++ with CLR.  This part of the code would be in a form header file.

Thanks!

Using ICorProfilerInfo::SetILFunctionBody, is it possible to add a try-finally EH clause to a method that does not have any exception handling?

$
0
0

I am working on an IL-rewriting profiler and my goal is to be able to add a try-finally block to methods.  Essentially:

    // IL to set some state
    try {
       // original IL
    } finally {
       // IL to revert state
    }

Based on the documentation and info for the profiling API (https://msdn.microsoft.com/en-us/library/ms232096.aspx), it appears one should be able use SetILFunctionBody to add new exception handling clauses.  

I've been following the example ILRewrite profiler from http://clrprofiler.codeplex.com/SourceControl/list/changesets?branch=master.  I've added code to add an "EHClause" to the EHClause list maintained by the "ILRewriter" class and added the appropriate leave.s and endfinally IL instructions. Everything appears to work from the profiler's standpoint (the SetILFunctionBody call is successful) but when the modified method is invoked, we get the dreaded "Common Language Runtime detected an invalid program." exception with no further information. 

Things I've tried:

  • Reviewed the instrumentation and the code is not doing things that are illegal in protected regions (e.g. return or branching outside). 
  • The instrumented method runs fine if I remove the EHClause and leave.s/endfinally instructions.
  • I've added lots of logging to the ILRewriting code to dump the modified IL, EH info, and bytes at the end.  I've made a similar method with the desired try-finally and state tracking code and the IL of the two methods (instrumented vs. compiled) is identical.  However the actual "exported" bytes are a good bit different.  

This leads me to believe that maybe adding a new exception-handling clause to a method without any to begin with simply isn't supported by the profiling API.  I'd love to hear otherwise and any of your ideas for how to resolve this problem.

Viewing all 1710 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>