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

6 system assemblies still load slow after ngen update

$
0
0

I'm building a VS 2012 WPF app targeting .NET 4.5 Any CPU on Win7. I notice in the debug output window that the 6 system assemblies beloweach take ~3-4 seconds to load. This delay occurseach time I run the app. I ran ngen update and rebooted, but it hasn't helped. The total app startup time is still about 24 seconds. The app includes about 16 other assemblies, including Unity, System.Web, System.Transactions, Extended WPF toolkit, System.Data.OracleClient (apparently EF requires this even if you aren't using Oracle), but all of them load very quickly. I've read various blogs about improving cold/warm boot times, but haven't found anything applicable here.

Q1. Why are some in GAC_MSIL vs. GAC_64?

Q2. Why are the version numbers 4.0_4.0.0.0 vs. 4.0.30319?

Q3. How can I speed it up?

Thanks!

Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero.dll'
Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll'
Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll'
Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXml.dll'
Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemData.dll'
Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemCore\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemCore.dll'


user account context

$
0
0

We have follwoing queries regarding "user Account Context"

1) What is the meaning of "user account context"?

2) What is the meaning of "the application runs under a user account context"?

3) What is the meaning of "application that runs under a user account context and when no user profile is associated with the user account context"?

4) We came across one Hotfix from Mocrosoft as "A .NET Framework 2.0 application that runs under a user account context when no user profile is associated with the user account context may crash, or you may receive an access violation error message" at"http://support.microsoft.com/kb/913384"

    We came across the mentioned Hotfix while searching the solution to our application which crash randomly. The Symptoms mentioned in the Hotfix are matching with Symptoms of our crashing application.

    We are testing our VS2005 VB.Net Application with SQL 2008 R2 as Database Application on Whindows 7 Machine. The Windows 7 has default Framework 2.0 - SP2 and 3.5 - SP1.

    i) The mentioned Hotfix applies to only Framework 2.0

   ii) The problem for which Hotfix released solved in Framework 2.0 - SP1 / SP2. 

   iii) The problem for which Hotfix released will not occured in Windows 7.

   iv ) The mentioned Hotfix is not appies to Windos 7

Our above mentioned understandings are correct?

5) we are STILL facing the crash problem mentioned in Symptoms of the Hotfix in Windows 7 machine. What are the probable root causes for same? We are trying to test application on newly installed Windows 7 machine. Is it correct step?

6) Is there any way to run the application without user account context ?

Thanks in advance...




Managed C++ Unmanaged C++ Events Delegates and Function Pointers

$
0
0

I'm having difficulty subscribing to events from an unmanaged C++ class in a managed C++ class. I'm a C# developer wrestling with Interop and C++ is an alien environment so I'm possibly missing something obvious.

I have to have an unmanaged C++ class because the SDK I'm using only supports this; the managed C++ is a wrapper allowing access from the C# project that I'm writing the rest of the project in.

I can subscribe to events from managed classes and believe that I need a delegate because the unmanaged code needs a pointer it can understand not the address of a managed function. C3374: can't take address of 'function' unless creating delegate instance was very useful in this respect.

But I cannot get the following code to compile or function - the code to subscribe to the events is in ManagedNS2::ManagedTarget::Init() and my attempts are preceeded with the compile error generated.

#include "stdafx.h"
#include <iostream>

using namespace System;
using namespace std;
using System::Runtime::InteropServices::Marshal;

namespace ManagedNS1
{
	public ref class ManagedSource
	{
		
	public:
		delegate void ManagedSourceEventDelegate();
		event ManagedSourceEventDelegate^ ManagedSourceEvent;
		void RaiseEvent();
	};
}

	void ManagedNS1::ManagedSource::RaiseEvent()
	{
		ManagedSourceEvent();
	}

namespace UnManagedNS1
{
	public class UnManagedSource
	{
		public:
			__event void UnManagedSourceEvent();
			void RaiseEvent();
	};
}

void UnManagedNS1::UnManagedSource::RaiseEvent()
{
	UnManagedSourceEvent();
}

namespace ManagedNS2
{
	public ref class ManagedTarget
	{
		public:			
			delegate void MyEventDelegate();
			ManagedNS1::ManagedSource managedSource;
			UnManagedNS1::UnManagedSource* unmanagedSource;
			
			MyEventDelegate^ del;
			ManagedTarget();
			~ManagedTarget();
			void EventHandler1();
			void EventHandler2();
			void Simulate();
			void Init();
	};
}
	
	ManagedNS2::ManagedTarget::ManagedTarget()
	{
		unmanagedSource = new UnManagedNS1::UnManagedSource();		
	}

	ManagedNS2::ManagedTarget::~ManagedTarget()
	{
		delete unmanagedSource;
	}

	void ManagedNS2::ManagedTarget::Init()
	{
		//subscribe to events from managedSource - this works
		managedSource.ManagedSourceEvent += gcnew ManagedNS1::ManagedSource::ManagedSourceEventDelegate(this, &ManagedNS2::ManagedTarget::EventHandler1);

		//subscribe to events from the unmanaged source - without delegate gives incompatible event (because unmanaged code needs native pointer it can understand; not an address of a managed function)
		//__hook(&UnManagedNS1::UnManagedSource::UnManagedSourceEvent, &unmanagedSource, &ManagedNS2::ManagedTarget::EventHandler);

		del = gcnew MyEventDelegate(this, &ManagedNS2::ManagedTarget::EventHandler2);
		IntPtr pMyEventDelegate = Marshal::GetFunctionPointerForDelegate(del);
		//improper syntax for specifying event handler in __hook/__unhook
		//__hook(&UnManagedNS1::UnManagedSource::UnManagedSourceEvent, &unmanagedSource, pMyEventDelegate.ToPointer());
		//invalid argument for delegate constructor; delegate target needs to be a pointer to a member function
		//managedSource.ManagedSourceEvent += gcnew ManagedNS1::ManagedSource::ManagedSourceEventDelegate(this, pMyEventDelegate.ToPointer());
		//invalid argument for delegate constructor; delegate target needs to be a pointer to a member function
		//managedSource.ManagedSourceEvent += gcnew ManagedNS1::ManagedSource::ManagedSourceEventDelegate(this, Marshal::GetFunctionPointerForDelegate(del).ToPointer());	


	}

	void ManagedNS2::ManagedTarget::EventHandler1()
	{
		printf("Event Detected From Managed\n\r");
	}

	void ManagedNS2::ManagedTarget::EventHandler2()
	{
		printf("Event Detected From Unmanaged\n\r");
	}

	void ManagedNS2::ManagedTarget::Simulate()
	{
		managedSource.RaiseEvent();
		unmanagedSource->RaiseEvent();
	}


int _tmain(int argc, _TCHAR* argv[])
{
	ManagedNS2::ManagedTarget t;
	t.Init();			//subscribe to events
	t.Simulate();		//raise the events

	char c;
	std::cout << "Press Return to Exit";
	c = cin.get();

	return 0;
}



Dave Bradshaw

.NET Runtime 2.0 Error, faulting module mscorwks.dll

$
0
0

i received a ".NET Runtime 2.0 Error" with an Event ID of 1000 that i don't understand and have been unable to reproduce. here is the error message:


Faulting application serializer.exe, version 4.0.2578.32199, stamp 45b55c7e, faulting module mscorwks.dll, version 2.0.50727.42, stamp 4333e7ec, debug? 0, fault address 0x001066ef.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


the application that had the error is an automated application that runs every night so i was not around to see it crash. any suggestions as to what may have caused it? also, what is mscorwks.dll?

Unhandled Exception: System.Security.SecurityException:

$
0
0

I made a console application in Visual Studio that reads a flat file from our customer and updates the oracle database depending on the received data.

I use streamreader / writer to read and write some files.

When I run my exe file locally everthing works fine.  When this exe is run on the application server this gives following error message :

 

Unhandled Exception: System.Security.SecurityException: Request for the permiss
on of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0
0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlM
rk& stackMark, Boolean isPermSet)
   at System.Security.CodeAccessPermission.Demand()
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access,
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encodi
g, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path)
   at COD_ITB.App_main_process.main()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Ver
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Write="\\GBN66W\GROUP\PROLOGS\SCRIPTS\BAT\DB52\TABAC\ITB\COD_ITB\LOG\LOG_ERROR"
>

The demand was for:
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Ver
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Write="\\GBN66W\GROUP\PROLOGS\SCRIPTS\BAT\DB52\TABAC\ITB\COD_ITB\LOG\LOG_ERROR"
>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib
 Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Read="USERNAME"/>
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Ver
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Read="P:\BAT\DB52\TABAC\ITB\COD_ITB\"
PathDiscovery="P:\BAT\DB52\TABAC\ITB\COD_ITB\"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission,
scorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="AssemblyIsolationByUser"
UserQuota="9223372036854775807"
Expiry="9223372036854775807"
Permanent="True"/>
<IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="ReflectionEmit"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, V
rsion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Assertion, Execution, BindingRedirects"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version
2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib
 Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Url="file:///P:/BAT/DB52/TABAC/ITB/COD_ITB/COD_ITB.exe"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorli
, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Zone="Intranet"/>
<IPermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=
eutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="DefaultPrinting"/>
</PermissionSet>

The assembly or AppDomain that failed was:
COD_ITB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
Void main()
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///P:/BAT/DB52/TABAC/ITB/COD_ITB/COD_ITB.exe

Can someone help me with this issue.

I am pretty unexperienced in developing VB applications

Ability to change reference without types check via DynamicMethod

$
0
0

Why using DynamicMethod allow to change reference without any types check? Is this known and explainable thing?

using System;
using System.Reflection;
using System.Reflection.Emit;

namespace Dynamics
{
	internal class Program
	{
		private static void Main(string[] args)
		{
			var a = new A();
			a.Name = "Name";
			Console.WriteLine(a.Name.GetType().Name);

			PropertyInfo pi = a.GetType().GetProperty("Name");

			DynamicMethod method = new DynamicMethod(
					"DynamicSetValue", // NAME
					null, // return type
					new Type[] 
                            {
                                typeof(object), // 0, objSource
                                typeof(object), // 1, value
                            }, // parameter types
					typeof(Program), // owner
					true); // skip visibility

			ILGenerator gen = method.GetILGenerator();
			gen.Emit(OpCodes.Ldarg_0);
			gen.Emit(OpCodes.Ldarg_1);
			gen.Emit(OpCodes.Call, pi.GetSetMethod(true));
			gen.Emit(OpCodes.Ret);			

			SetValue setMethod = (SetValue)method.CreateDelegate(typeof(SetValue));

			int val = 123;
			setMethod(a, val);
			Console.WriteLine(a.Name.GetType().Name);

			A anotherA = new A();
			anotherA.Name = "Another A";
			setMethod(a, anotherA);
			Console.WriteLine(a.Name.GetType().Name);
		}
	}

	public class A
	{
		public string Name { get; set; }
	}

	public delegate void SetValue(object obj, object val);
}
(.NET 4.5)


Alexander Anisov



Error System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

$
0
0

Hi 

Anyone has any idea on how to solve this problem 

Error System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Application : ASP

Hosting: GoDaddy

DotNet=4.0

Portable Libraries and CLR fragmentation becoming more and more of an issue.

$
0
0

Hello,

It seems the in ability to load of Portable Libraries as well as Silverlight libraries becoming more problematic everyday.

I am one of the contributors of language called Nemerle. http://nemerle.org/ It is a 10 years old compiler basically it uses System.Reflection.Emit to read the types and generate the IL code. The first major problem we hit at the emergence of Silverlight. Since silverlight and portable libraries use a different version of mscorlib (2.0.5.0) and since CLR has some limit of only loading 1 instance of mscorlib, we were unable to generate silverlight libraries. Mono on linux people and boo compiler (probably somewhere on the road F# too)  and other compilers using System.Reflection.Emit also encountered same problems.

Some people choose using IKVM.Reflection.Emit some others tried Mono.Cecil, and Microsoft introduced CCI (which is windows only and relies on COM IIRC)

At that time Nemerle developers simply gave up working on this issue , we thought we can go on without silverlight since Nemerle is a better language than both C# and F# :)

However these days more and more libraries started using Portable Class Libraries for the sake of better portability which is good but also causing lot of problems on the otherside.

You may consider Nemerle as a mostly unknown language with insignificant number of users. (I bet you haven't heard it before)  but these problems are not limited to Nemerle.

I've seen problems like older versions of .NET Framework 4.0 can't deal with PCL, or another example is that there are cases where XAML designer in VS 2012 with PCL . Also Sandcastle tool have problems with it.  I can see this is getting more and more annoying.

Another example would be from .NET 4 or .NET 4.5 create a console app try some code like this

            var a = System.Reflection.Assembly.ReflectionOnlyLoadFrom(@"c:\mscorlib.dll");
            Console.WriteLine(a.GetExportedTypes());

I assume you copy mscorlib 2.0.5.0 to some known location like C:\

This code simply fails with a NRE because it cannot find the parent of System.Object in the PCL version of mscorlib.

Note that these are just examples not the real problem. I know you will say "unfortunately current version of CLR cannot handle this". That's fine. But what I'd like to hear is that you may try to fix this in the future versions so that SRE and Reflection can work someway properly.

This is all IL code we are talking about it should be possible to merge these differences in some more transparent way. Otherwise future problems can produce a lot of headache for everyone


System.InvalidOperationException was unhandled

$
0
0
System.InvalidOperationException was unhandled
  Message="An error occurred creating the form. See Exception.InnerException for details.  The error is: Retrieving the COM class factory for component with CLSID {A98252EB-17D9-11D1-A181-0000F8773CDC} failed due to the following error: 80040154."
  Source="FactoryLoadTruck"
  StackTrace:
       at FactoryLoadTruck.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
       at FactoryLoadTruck.My.MyProject.MyForms.get_LoadTruck()
       at FactoryLoadTruck.My.MyApplication.OnCreateMainForm() in C:\Users\George\Documents\George\Software\BarCode(Truck Program)\Truck Programs 02-22-10\FactoryLoadTruck\FactoryLoadTruck\My Project\Application.Designer.vb:line 35
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at FactoryLoadTruck.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Runtime.InteropServices.COMException
       Message="Retrieving the COM class factory for component with CLSID {A98252EB-17D9-11D1-A181-0000F8773CDC} failed due to the following error: 80040154."
       Source="FactoryLoadTruck"
       ErrorCode=-2147221164
       StackTrace:
            at FactoryLoadTruck.LoadTruck..ctor() in C:\Users\George\Documents\George\Software\BarCode(Truck Program)\Truck Programs 02-22-10\FactoryLoadTruck\FactoryLoadTruck\LoadTruck.vb:line 4
       InnerException:

Defining required access rights for a service with ServiceController

$
0
0

Hello,

 

I'm pretty sure this is straight forward I just can't seem to get it working.

 

I have a service called serviceX and I want to control it from another application.  The "control" is simply checking the ServiceController.Status field and calling ServiceController.Start().

 

The exception i get is:-

System.InvalidOperationException: Cannot open serviceX service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied

--- End of inner exception stack trace ---

at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)

at System.ServiceProcess.ServiceController.Start(String[] args)

at SnippetCompiler.ServiceMonitor.StartService()

 

In Win32 I would specify SERVICE_QUERY_STATUS and SERVICE_START as the required access in the OpenService API call.  How do I do this in managed code?  I can only assume I need to use a ServiceControllerPermission object but I can't figure out how.

 

Keith.

VS2005 vb.net multi threaded application with MS SQL 2008 R2 as a database Crashed

$
0
0

Dear All,

We are working VS2005 vb.net multi threaded application with MS SQL 2008 R2 as a database. The application we are testing on Windows 7 (32 Bit) machine. Currently Following frameworks are installed.

1) 2.0 - SP2          2) 3.0 - SP2          3) 3.5 - SP1

The application is running correctly as per client requirement. But sometime it got crashed with message"a problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available".Till date, the maximum time for which application run without crash is 1 day.

We observed following two consecutive logs in Event Viewer > Windows Logs > Application

1) Event 1023, .NET Runtime

   .NET Runtime version 2.0.50727.5472 - Fatal Execution Engine Error (7216F7AE) (80131506)

2) Event 1000, Application Error

    Faulting application name: Our Application Name.exe, version: 1.0.0.0, time stamp: 0x51f7b33b

    Faulting module name: mscorwks.dll, version: 2.0.50727.5472, time stamp: 0x5174dd69

    Exception code: 0xc0000005

    Fault offset: 0x000a1919

    Faulting process id: 0x%9

    Faulting application start time: 0x%10

    Faulting application path: %11

    Faulting module path: %12

   Report Id: %13

To resolve the problem basis our internet search and couple of queries which we posted, we carried out following exercise

    It talks about the same error which we are facing, which includes two error messages in event viewer with Event ID: 1023 and 1000. We also observed mentioned two event id as mentioned above. We download the Hotfix and try to install. But we came across the error message as “The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program

    Our queries:

    1 ) Which are the other probable cuases of the problem? How to resolve them?

    2) The hotfix not installed because framework 2.0 - SP2 already installed. Is our understaning correct?

    3) As defination of the Hotfix which we downloaded, do we need to run application without user account context? If answer is Yes, then suggest how to carry out same.

    Thanks in advance.....

    TypeInitializationException in a 64 bit Managed VC++ exe (for 4.5 Framwork) which was created using ILMerge.

    $
    0
    0

    We have a Managed VC++ .exe (for 4.5 Framwork) file that was built using ILMerge. The exe is working perfectly fine when compiled with 32 bit platform configuration. However, we are getting the following TypeInitializationException when compiled with 64 bit configuration:

    Unhandled Exception: System.TypeInitializationException: The type initializer fo

    r '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadExcep

    tion: The C++ module failed to load during vtable initialization.

    ---> System.ArgumentOutOfRangeException: Token 0 is not valid in the scope of m

    odule System.ModuleHandle.

    Parameter name: metadataToken

       at System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module,

    Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPt

    r[] methodInstantiationContext, Int32 methodInstCount)

       at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int3

    2 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[]

    methodInstantiationContext)

       at System.ModuleHandle.ResolveMethodHandle(Int32 methodToken, RuntimeTypeHand

    le[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)

       at <CrtImplementationDetails>.ThisModule.ResolveMethod<void const * __clrcall

    (void)>(IntPtr methodToken) in f:\dd\vctools\crt_bld\self_64_amd64\crt\src\purem

    silcode.cpp:line 154

       at _initterm_m((fnptr)* pfbegin, (fnptr)* pfend) in f:\dd\vctools\crt_bld\sel

    f_64_amd64\crt\src\puremsilcode.cpp:line 218

       at <CrtImplementationDetails>.LanguageSupport.InitializeVtables(LanguageSuppo

    rt* A_0) in f:\dd\vctools\crt_bld\self_64_amd64\crt\src\mstartup.cpp:line 332

       at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* A_

    0) in f:\dd\vctools\crt_bld\self_64_amd64\crt\src\mstartup.cpp:line 546

       at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* A_0

    ) in f:\dd\vctools\crt_bld\self_64_amd64\crt\src\mstartup.cpp:line 703

       --- End of inner exception stack trace ---

       at <CrtImplementationDetails>.ThrowModuleLoadException(String errorMessage, E

    xception innerException) in f:\dd\vctools\crt_bld\self_64_amd64\crt\src\minterna

    l.h:line 194

       at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* A_0

    ) in f:\dd\vctools\crt_bld\self_64_amd64\crt\src\mstartup.cpp:line 713

       at .cctor() in f:\dd\vctools\crt_bld\self_64_amd64\crt\src\mstartup.cpp:line

    754

       --- End of inner exception stack trace ---


    How to trace a specific request

    $
    0
    0

    Hi there,

    My scenario is: there is a asp.net application. a few end-users get very slow response. I need to know the time period of every steps/stack: how much time the IIS dispatch the request, how much time the business logic execute, especially, every call stack execute time period, in my scenario, there is a WCF service to provide some data. I also need to know this time period.

    Does anyone can give me some related articles?

    Thanks.

    Mike Feng


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    What is 'clr!CLRSemaphore::Wait' ?

    $
    0
    0

    Hello,

    I have several production dumps where client is reported to just hang. Based on 'some' analysis, There are several threads (almost 3 to 4) whose top of the stack is clr!CLRSemaphore::Wait?

    Can someone help in  understanding the construct? What does this operation account to the thread activity/health?

    I did not find any helpful documentation to help understand this kind of call stack.

    Thank you...


    Using WinRT's Photocapturedevice APIs into a Service

    $
    0
    0

    Is there a problem to call WRL/ WinRT APIs from a DLL? If yes, what, why? Is there a workaround? Why does my code work sometimes but crash sometimes? Call stack is as displayed below:

    0: kd> kb
      *** Stack trace for last set context - .thread/.cxr resets it
    Child-SP RetAddr  : Args to Child                       : Call Site
    01d9f740 766901aa : e0797977 00000001 00000000 77611edb : KERNELBASE!RaiseException+0x36
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for EMCLIENT.dll -
    01d9f7a0 6ffca522 : 76690171 800705aa 01d9f800 6ffca523 : EMCLIENT!SHTerminateProcessForOOM+0x3a
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for CaptureServiceClient.dll -
    01d9f7b0 6ffc5dec : 00000000 00000000 00000000 00000000 : CaptureServiceClient!PInvoke_LegacyAPIHelper_ClearCallback+0x2ce
    01d9f808 6ffaf2cc : 800705aa 00fb61a8 8000ffff 800705aa : CaptureServiceClient!DllCanUnloadNow+0x1901c
    01d9f820 6ffbcafa : ffffff00 777ffff9 00fb61a8 8000ffff : CaptureServiceClient!DllCanUnloadNow+0x24fc
    01d9f838 6ffad674 : 800705aa 013738c8 00000000 00000000 : CaptureServiceClient!DllCanUnloadNow+0xfd2a
    01d9f898 6ffaeb1e : 800705aa fefefefe 000003c4 0000003f : CaptureServiceClient!DllCanUnloadNow+0x8a4
    01d9f908 6ffae8da : 800705aa fefefefe 000003c4 0000003f : CaptureServiceClient!DllCanUnloadNow+0x1d4e
    01d9fb50 6ffae71a : 4ea8649e 35ffdfc5 6ffa2860 7fb14000 : CaptureServiceClient!DllCanUnloadNow+0x1b0a
    01d9fdb0 77825966 : 01045418 00000000 00000000 6ffae705 : CaptureServiceClient!DllCanUnloadNow+0x194a
    01d9fdd0 00000000 : 00000000 77825951 00000000 00000000 : ntdll!RtlUserThreadStart+0x16


    EMC


    Integrate or convert C++ project to C#

    $
    0
    0

    I have a C++ visual studio project that generates an .exe that performs particular tasks .

    I want to integrate it and use it's methods in my C# application .

    Witch is the easiest way to accomplish this ?

     

    I have basic knowledge in C++ and I'm a beginner in  C# . Please post some detailed instructions . I'm using Visual studio 2010 ultimate .

    List Of DateFormat supported by each locale

    $
    0
    0

    Hi

         Question about formatting the datetime string by passing dateformat and locale ID using ToString() function, 

    1. How many .net supported date formats available?

    2.  Where do I get the list of formats supported by each locale?

    3. Is it possible that any particular locale doesn't support any specific format?

    Thanks

    kalais

    VS2010 vb.net multi threaded application with MS SQL 2008 R2 Database, Framework 4.0 on Windows 7 (32 Bit) Crashed

    $
    0
    0

    We are working VS2010 vb.net multi threaded application with MS SQL 2008 R2 as a database. The application we are testing on Windows 7 (32 Bit) machine which has Framework 4.0 installed.

    While testing sometimes (twice a day) we came across 'Application Crash' situation withtwo consecutive logs in Event Viewer > Windows Logs > Application

    Earlier we used to faced the similar issue on VS2005 with bit higher frequency ( 5 times a day) . To overcome same we decided to upgrade code to VS2010.

    Log 1:

    Log Name:      Application
    Source:        .NET Runtime
    Date:          8/5/2013 3:26:45 PM
    Event ID:      1023
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      OCLAP0084
    Description:
    Application: <Our application name>.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an internal error in the .NET Runtime at IP 72CF8F00 (72BB0000) with exit code 80131506.

    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name=".NET Runtime" />
        <EventID Qualifiers="0">1023</EventID>
        <Level>2</Level>
        <Task>0</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-08-05T09:56:45.000000000Z" />
        <EventRecordID>2778</EventRecordID>
        <Channel>Application</Channel>
        <Computer>OCLAP0084</Computer>
        <Security />
      </System>
      <EventData>
        <Data>Application: <Our application name>.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an internal error in the .NET Runtime at IP 72CF8F00 (72BB0000) with exit code 80131506.
    </Data>
      </EventData>
    </Event>

    Log 2:

    Log Name:      Application
    Source:        Application Error
    Date:          8/5/2013 3:26:46 PM
    Event ID:      1000
    Task Category: (100)
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      OCLAP0084
    Description:
    Faulting application name: MiPOS Local POS App.exe, version: 1.0.0.0, time stamp: 0x51fbbeaa
    Faulting module name: clr.dll, version: 4.0.30319.2012, time stamp: 0x517a1d31
    Exception code: 0xc0000005
    Fault offset: 0x00148f00
    Faulting process id: 0x38c
    Faulting application start time: 0x01ce91c2112a9348
    Faulting application path: C:\Program Files\MIDCO\MiPOS\Local POS\MiPOS Local POS App.exe
    Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Report Id: 56a7113a-fdb5-11e2-bb09-74f06dc06d55
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="Application Error" />
        <EventID Qualifiers="0">1000</EventID>
        <Level>2</Level>
        <Task>100</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-08-05T09:56:46.000000000Z" />
        <EventRecordID>2779</EventRecordID>
        <Channel>Application</Channel>
        <Computer>OCLAP0084</Computer>
        <Security />
      </System>
      <EventData>
        <Data>MiPOS Local POS App.exe</Data>
        <Data>1.0.0.0</Data>
        <Data>51fbbeaa</Data>
        <Data>clr.dll</Data>
        <Data>4.0.30319.2012</Data>
        <Data>517a1d31</Data>
        <Data>c0000005</Data>
        <Data>00148f00</Data>
        <Data>38c</Data>
        <Data>01ce91c2112a9348</Data>
        <Data>C:\Program Files\MIDCO\MiPOS\Local POS\MiPOS Local POS App.exe</Data>
        <Data>C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll</Data>
        <Data>56a7113a-fdb5-11e2-bb09-74f06dc06d55</Data>
      </EventData>
    </Event>

    While finding the solution we carried out following activities:

    1) we came across the Hotfix at "http://support.microsoft.com/kb/2640103". We installed same on the machine on which we are carrying out the testing. After installing Hotfix also we are facing the problem. We are not yet installed same on the machine on which we are compiling the code. Now we will install sameon the machine on which we are compiling the code and will carry out the testing.

    2) disabled concurrent garbage collector using following content of config file

    <?xml version="1.0"?>

    <configuration>

    <runtime>

    <gcConcurrent enabled="false"/>

    </runtime>

    <system.diagnostics>

    <sources>

    <!-- This section defines the logging configuration for My.Application.Log -->

    <source name="DefaultSource" switchName="DefaultSwitch">

    <listeners>

    <add name="FileLog"/>

    <!-- Uncomment the below section to write to the Application Event Log -->

    <!--<add name="EventLog"/>-->

    </listeners>

    </source>

    </sources>

    <switches>

    <add name="DefaultSwitch" value="Information"/>

    </switches>

    <sharedListeners>

    <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>

    <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->

    <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->

    </sharedListeners>

    </system.diagnostics>

    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

     

    Our Queries :

    1 ) do we need to install the hotfix on machine on which we are compiling the code as well as the machine on which we are carrying out the testing?

    2) Installing hotfix only on machine on which we are carrying out the testing will create any issue?

    3) Which are the other possible resons for which we might face the mentioned problem? How to resolve same?

    Thanks in advance.....

    How to marshal safearray arguments when calling managed C# method from unmanaged C++?

    $
    0
    0

    I'm trying to utilize an old application framework from managed C# code but I don't understand how to marshal the safearray argument which is forwarded to the managed code. Here is a code snipped describing how the managed code is called:

    try {
        _ObjectHandlePtr pObjectHandle; 
        _ObjectPtr pObject; 
        _TypePtr pType;
        SAFEARRAY* psa;// Create an instance of a type from an assembly
        pObjectHandle = pDefaultDomain->CreateInstanceFrom(L"ClassLibrary1.dll",   // no path -- local directory
                                  L"ClassLibrary1.Class1");
        variant_t vtobj = pObjectHandle->Unwrap();                   // Get an _Object (as variant) from the _ObjectHandle
        vtobj.pdispVal->QueryInterface(__uuidof(_Object),(void**)&pObject); // QI the variant for the Object iface
        pType = pObject->GetType();                             // Get the _Type iface
        psa = SafeArrayCreateVector(VT_VARIANT,0,1);               // Create a safearray (0 length)
    		LONG index = 0;
    		variant_t task = msg.task;
    		SafeArrayPutElement(psa, &index, &task);//variant_t vtret;
        hr = pType->InvokeMember_3("Test",                           // Invoke "Test" method on pType
                   BindingFlags_InvokeMethod,
                   NULL,
                   vtobj,
                   psa);
        SafeArrayDestroy(psa);                                  // Destroy safearray
      }catch(_com_error& error) {
        _tprintf(TEXT("ERROR: %s\n"),(_TCHAR*)error.Description());goto exit;
      } 

    The msg.task is a plain unsigned int for testing purpose only. But how do I catch the psa safearray structure in the argument of the managed method (ClassLibrary1.Class1.Test)?

    w3w worker processes crashes

    $
    0
    0

    We have an old .net 2.0 web application.  We need to make some code changes to it so I installed Visual Studio 2005 on my Windows 7 computer and configured everything I think needed to be configured.  When I try to run the application, the w3w worker processes crashes each time (so far I was able to identify two places where this happens).  Here is what the Event Viewer shows:

    Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7a5f8
    Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
    Exception code: 0xc0000005
    Fault offset: 0x0ec83720
    Faulting process id: 0x8c4
    Faulting application start time: 0x01ce9505fe968c11
    Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
    Faulting module path: unknown
    Report Id: 4051c497-00f9-11e3-8fa3-782bcb9b7670

    I don't have much experience analyzing dump files but I created a crash rule using Debug Diagnostics Tool 1.2 and then when I opened the dump file using windbg.exe this is what's in it:

    Comment: 'Dump created by DbgHost. Second_Chance_Exception_C0000005'
    Symbol search path is: srv*c:\cache*http://msdl.microsoft.com/download/symbols
    Executable search path is:
    Windows 7 Version 7601 (Service Pack 1) MP (2 procs) Free x86 compatible
    Product: WinNt, suite: SingleUserTS
    Machine Name:
    Debug session time: Fri Aug  9 09:58:52.000 2013 (UTC - 4:00)
    System Uptime: 0 days 18:48:33.318
    Process Uptime: 0 days 0:00:10.000
    ................................................................
    ................................................................
    ...............................................................
    Loading unloaded module list
    ..
    This dump file has an exception of interest stored in it.
    The stored exception information can be accessed via .ecxr.
    (23e8.9b8): Access violation - code c0000005 (first/second chance not available)
    eax=3f869172 ebx=002a0116 ecx=104bf8c0 edx=77be7094 esi=10257550 edi=0ed2db28
    eip=0ed2db28 esp=104bf8fc ebp=104bf944 iopl=0         nv up ei pl nz na pe nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
    0ed2db28 c744240450752510 mov     dword ptr [esp+4],10257550h ss:0023:104bf900=002a0116

    I have search the internet for the error message I'm getting and I have found 2 different reasons people would get a similar crash:

    - reason 1 was when the app had some infinite loop in it - I don't think this is my case since our application has been in production for over 6 years now not causing any problems

    - the second reason was permissions related e.g. when the app is trying to write to some file that it has no permission to write.  That is a possibility since I am setting it up on a new computer.  However, one place where this crash occurs is when a user selects a value from a drop down list, and the app is supposed to retrieve data from the database and populate another drop down list based on that.  However, the crash does not always happen in this place.  Only sometimes.  And the connection to the database definitely works since everything works fine in many other places in the app.

    Any help or troubleshooting ideas will be greatly appreciated.

    thanks,

    Viewing all 1710 articles
    Browse latest View live


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