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

Hooking into load of App.config/Web.config ??

$
0
0

I have some issues where same configuration information is scattered into many different configuration files.

I sort of now how to solve it at deploy time but I would like if Operations only had one place to change vital information.

One way to do this, would be some sort of runtime macrosubstituions. For instance

$(ENV_VARIABLE)For substituting a value with the value from the environment variables

$(INCLUDE_FILE)For including another file

$(PROPERTY_FILE_KEY)Like (N)ANT: Refer to a value in a property file

I order to do this I need to be able to hook into the configuration XML nodes when they are loaded. I could probably do this in configuration section handlers, but I would like something generic.

And of course: If anyone has created already, that would just be swell :)

Best regards

Soeren D. 


Web based application

$
0
0

I want to read all excel sheets in one excel file by specifiying few cell addresses which has no header using web based application.

Kindly help me.


Check .NET Version When Starting C# Application

$
0
0

I have a C# application written on Windows 8.1 using Visual Studio Express 2013. So it requires .NET framework 4.5 to run.

Windows 7 systems in my production environment will not have .NET 4.5 on them.  Instead just 4.0.  Will be installing 4.5 ONLY where this particular application is needed.

If the program attempts to start on a system with no .NET 4.5, it immediately crashes.

I'd like to be able to handle checking if .NET version 4.5 is installed immediately when program starts so I can gracefully inform the end user this cannot run unless 4.5 is installed, and terminate once user presses OK.

Cannot figure out where to place code to check this early enough.  I attempted to use the App.Startup event, but it doesn't seem to fire in a Windows 7 .NET 4.5 system at all, only Windows 8 .NET 4.5 which I find really strange!

Any thoughts?

Evaluating third party tools for 64-bit compatability

$
0
0

Hi.

I hope this is a reasonable forum to choose.

Desktop WinForms application, C#, Framework 4.0, Visual Studio 2010 SP1.

I'm evaluating migrating an app to 64-bit.  I've read what I could, then figured I'd try a test before contacting any vendor: create a new project with one form, add their control to the form, build for x64 (cross-dev), then copy the binaries to a 64-bit system and try a launch.

The third party tools are assemblies, which also target Framework 4.0

First question: what should I expect to see in dependency walker (depends22x64)?  What I do see is that the dll file for each third-party component shows as 32 bit.

In the testing, two of the components loaded, while a third caused an error like this:

Application: WinForms64BitTestC1andTList.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.BadImageFormatException
Stack:
   at WinForms64BitTest.Form1.InitializeComponent()
   at WinForms64BitTest.Form1..ctor()
   at WinForms64BitTest.Program.Main()

Now, the norm in .NET is that, through the CLR, an application or component can run either way?  Is that right?  Is the 32-bit designation in Depends a counter-indication?  The application (exe) itself shows as 64-bit in Depends.

Thanks!

Art


Arthur Gardner


Access Violation in .NET 4 Runtime in gc_heap::garbage_collect with no unmanaged modules

$
0
0

Hi all,

We are experiencing an access violation in the .NET 4.0 runtime, in a piece of code that uses NHibernate heavily. None of our own code interops with native code directly, nor does the 3rd party code we are using (to the best of our knowledge). We cannot identify the memory pattern that is appears to be corrupting the GC heap, and we don't know whether the problem is in the GC itself or in some other piece of code that is corrupting it.

I've included below the stack trace of the offending thread, and the list of loaded modules.

We need some help debugging this issue. What should we do next?

Thanks,
Adam Smith
Director, Technology
Hubbard One
Thomson Reuters

 

0:000> !EEStack
---------------------------------------------
Thread   0
Current frame: clr!WKS::gc_heap::find_first_object+0x64
ChildEBP RetAddr  Caller, Callee
0012bf30 791fa5b8 clr!WKS::gc_heap::mark_through_cards_for_segments+0x116, calling clr!WKS::gc_heap::find_card
0012bf38 791fa618 clr!WKS::gc_heap::mark_through_cards_for_segments+0x563, calling clr!WKS::gc_heap::find_first_object
0012bfc4 791faaa1 clr!WKS::gc_heap::relocate_phase+0x5b, calling clr!WKS::gc_heap::mark_through_cards_for_segments
0012c000 791f7a52 clr!WKS::gc_heap::plan_phase+0x851, calling clr!WKS::gc_heap::relocate_phase
0012c038 791a1be6 clr!HndScanHandlesForGC+0x125, calling clr!_EH_epilog3
0012c03c 791a2424 clr!Ref_ScanDependentHandlesForClearing+0x61, calling clr!HndScanHandlesForGC
0012c044 791a2291 clr!SyncBlockCache::GCWeakPtrScan+0x61
0012c0dc 791f73d1 clr!WKS::gc_heap::gc1+0x140, calling clr!WKS::gc_heap::plan_phase
0012c100 791f7972 clr!WKS::gc_heap::garbage_collect+0x3ae, calling clr!WKS::gc_heap::gc1
0012c118 791f6edd clr!WKS::gc_heap::soh_try_fit+0x16b, calling clr!WKS::gc_heap::a_fit_segment_end_p
0012c184 791f771f clr!WKS::GCHeap::GarbageCollectGeneration+0x17b, calling clr!WKS::gc_heap::garbage_collect
0012c1a8 791f6b68 clr!WKS::gc_heap::try_allocate_more_space+0x23a, calling clr!WKS::gc_heap::allocate_small
0012c1b0 791f878a clr!WKS::gc_heap::try_allocate_more_space+0x162, calling clr!WKS::GCHeap::GarbageCollectGeneration
0012c1d4 791f6b82 clr!WKS::gc_heap::allocate_more_space+0x13, calling clr!WKS::gc_heap::try_allocate_more_space
0012c1e8 791f6e65 clr!WKS::GCHeap::Alloc+0x3d, calling clr!WKS::gc_heap::allocate_more_space
0012c208 7919c953 clr!Alloc+0x8d
0012c224 7916089d clr!SlowAllocateString+0x42, calling clr!Alloc
0012c258 7919c876 clr!HelperMethodFrame::LazyInit+0x17, calling  (JitHelp: CORINFO_HELP_GET_THREAD)
0012c264 79160973 clr!FramedAllocateString+0xc9, calling clr!SlowAllocateString
0012c2ac 791608f6 clr!FramedAllocateString+0x18, calling clr!LazyMachStateCaptureState
0012c2e0 0703bec0 (MethodDesc 06ba8e80 +0xf0 NHibernate.Engine.Cascade.DeleteOrphans(System.String, NHibernate.Collection.IPersistentCollection)), calling clr!JIT_IsInstanceOfInterface
0012c300 79b3781c (MethodDesc 798fbdcc +0x7c System.String.Concat(System.String, System.String)), calling 00972350
0012c318 06bcadf0 (MethodDesc 06ba8e74 +0x2f0 NHibernate.Engine.Cascade.CascadeCollectionElements(System.Object, NHibernate.Type.CollectionType, NHibernate.Engine.CascadeStyle, NHibernate.Type.IType, System.Object, Boolean)), calling (MethodDesc 798fbdcc +0 System.String.Concat(System.String, System.String))
0012c34c 06bcaab9 (MethodDesc 06ba8e5c +0x99 NHibernate.Engine.Cascade.CascadeCollection(System.Object, NHibernate.Engine.CascadeStyle, System.Object, NHibernate.Type.CollectionType)), calling (MethodDesc 06ba8e74 +0 NHibernate.Engine.Cascade.CascadeCollectionElements(System.Object, NHibernate.Type.CollectionType, NHibernate.Engine.CascadeStyle, NHibernate.Type.IType, System.Object, Boolean))
0012c380 06bcaa07 (MethodDesc 06ba8e50 +0x77 NHibernate.Engine.Cascade.CascadeAssociation(System.Object, NHibernate.Type.IType, NHibernate.Engine.CascadeStyle, System.Object, Boolean)), calling (MethodDesc 06ba8e5c +0 NHibernate.Engine.Cascade.CascadeCollection(System.Object, NHibernate.Engine.CascadeStyle, System.Object, NHibernate.Type.CollectionType))
0012c3a0 06bc7f7d (MethodDesc 06ba8e2c +0x4d NHibernate.Engine.Cascade.CascadeProperty(System.Object, NHibernate.Type.IType, NHibernate.Engine.CascadeStyle, System.Object, Boolean)), calling (MethodDesc 06ba8e50 +0 NHibernate.Engine.Cascade.CascadeAssociation(System.Object, NHibernate.Type.IType, NHibernate.Engine.CascadeStyle, System.Object, Boolean))
0012c3c4 06bc7c99 (MethodDesc 06ba8e20 +0x159 NHibernate.Engine.Cascade.CascadeOn(NHibernate.Persister.Entity.IEntityPersister, System.Object, System.Object)), calling (MethodDesc 06ba8e2c +0 NHibernate.Engine.Cascade.CascadeProperty(System.Object, NHibernate.Type.IType, NHibernate.Engine.CascadeStyle, System.Object, Boolean))
0012c40c 06bcb8a4 (MethodDesc 04b699a0 +0x64 NHibernate.Event.Default.AbstractFlushingEventListener.CascadeOnFlush(NHibernate.Event.IEventSource, NHibernate.Persister.Entity.IEntityPersister, System.Object, System.Object)), calling (MethodDesc 06ba8e20 +0 NHibernate.Engine.Cascade.CascadeOn(NHibernate.Persister.Entity.IEntityPersister, System.Object, System.Object))
0012c440 06bcb793 (MethodDesc 04b69994 +0xf3 NHibernate.Event.Default.AbstractFlushingEventListener.PrepareEntityFlushes(NHibernate.Event.IEventSource)), calling (MethodDesc 04b699a0 +0 NHibernate.Event.Default.AbstractFlushingEventListener.CascadeOnFlush(NHibernate.Event.IEventSource, NHibernate.Persister.Entity.IEntityPersister, System.Object, System.Object))
0012c47c 06bcb388 (MethodDesc 04b69968 +0x88 NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(NHibernate.Event.FlushEvent)), calling (MethodDesc 04b69994 +0 NHibernate.Event.Default.AbstractFlushingEventListener.PrepareEntityFlushes(NHibernate.Event.IEventSource))
0012c4b0 06bcb24d (MethodDesc 04b69b74 +0x2d NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(NHibernate.Event.FlushEvent))
0012c4c4 06bcb195 (MethodDesc 02af3330 +0xd5 NHibernate.Impl.SessionImpl.Flush()), calling 057f5e72

            Base TimeStamp                     Module
          400000 48ebcdd3 Oct 07 17:00:03 2008 X:\ContactNet\bin\NAnt.exe
        7c800000 49900d60 Feb 09 06:02:56 2009 C:\WINDOWS\system32\ntdll.dll
        79000000 4af3af84 Nov 06 00:09:24 2009 C:\WINDOWS\system32\mscoree.dll
        77e40000 49c51f0a Mar 21 13:08:26 2009 C:\WINDOWS\system32\KERNEL32.dll
        7d1e0000 4a61f120 Jul 18 11:58:24 2009 C:\WINDOWS\system32\ADVAPI32.dll
        77c50000 49f5889a Apr 27 06:27:38 2009 C:\WINDOWS\system32\RPCRT4.dll
        76f50000 4a3742b4 Jun 16 02:59:00 2009 C:\WINDOWS\system32\Secur32.dll
        603b0000 4ba1d8a9 Mar 18 03:39:21 2010 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll
        77da0000 45d70ac0 Feb 17 09:01:36 2007 C:\WINDOWS\system32\SHLWAPI.dll
        77c00000 4900637a Oct 23 07:43:54 2008 C:\WINDOWS\system32\GDI32.dll
        77380000 45e7c676 Mar 02 01:38:46 2007 C:\WINDOWS\system32\USER32.dll
        77ba0000 45d70b06 Feb 17 09:02:46 2007 C:\WINDOWS\system32\msvcrt.dll
        76290000 45d70a5f Feb 17 08:59:59 2007 C:\WINDOWS\system32\IMM32.DLL
        79140000 4ba1d9ef Mar 18 03:44:47 2010 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
        79060000 4ba1dbf2 Mar 18 03:53:22 2010 C:\WINDOWS\system32\MSVCR100_CLR0400.dll
        79880000 4ba1da6f Mar 18 03:46:55 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\mscorlib\246f1a5abb686b9dcdf22d3505b08cea\mscorlib.ni.dll
        77670000 45d70aa5 Feb 17 09:01:09 2007 C:\WINDOWS\system32\ole32.dll
        4b3c0000 45d70ab2 Feb 17 09:01:22 2007 C:\WINDOWS\system32\MSCTF.dll
        60340000 4ba1d8aa Mar 18 03:39:22 2010 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\culture.dll
        60930000 4ba1d8ae Mar 18 03:39:26 2010 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\nlssorting.dll
        79810000 4ba1da36 Mar 18 03:45:58 2010 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clrjit.dll
        68000000 45d69786 Feb 17 00:49:58 2007 C:\WINDOWS\system32\rsaenh.dll
        76b70000 45d70ab5 Feb 17 09:01:25 2007 C:\WINDOWS\system32\PSAPI.DLL
         32e0000 45d69418 Feb 17 00:35:20 2007 C:\WINDOWS\system32\xpsp2res.dll
        77b90000 45d70ac8 Feb 17 09:01:44 2007 C:\WINDOWS\system32\VERSION.dll
        7a820000 4ba1dff4 Mar 18 04:10:28 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System\964da027ebca3b263a05cadb8eaa20a3\System.ni.dll
        60c90000 4ba1e04b Mar 18 04:11:55 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Configuration\ac18c2dcd06bd2a0589bac94ccae5716\System.Configuration.ni.dll
        69720000 4ba1dfec Mar 18 04:10:20 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Xml\e997d0200c25f7db6bd32313d50b729d\System.Xml.ni.dll
        6f350000 4a4eaae7 Jul 03 21:05:43 2009 C:\WINDOWS\system32\urlmon.dll
        77d00000 4760e409 Dec 13 02:49:29 2007 C:\WINDOWS\system32\OLEAUT32.dll
        40a90000 4a4eaae8 Jul 03 21:05:44 2009 C:\WINDOWS\system32\iertutil.dll
        77420000 45d70a05 Feb 17 08:58:29 2007 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_D8713E55\comctl32.dll
        7c8d0000 485819a8 Jun 17 16:08:08 2008 C:\WINDOWS\system32\SHELL32.dll
        44f20000 4ba1e740 Mar 18 04:41:36 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\Microsoft.Build.Fra#\11ef4be6ee227fce3725d6df534297a4\Microsoft.Build.Framework.ni.dll
        60e50000 4ba1dfee Mar 18 04:10:22 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Core\713647b987b140a17e3c4ffe4c721f85\System.Core.ni.dll
        67160000 4ba1e0c5 Mar 18 04:13:57 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Web\a70842538614699d690561ef5f43598b\System.Web.ni.dll
        5e0d0000 4ba2183b Mar 18 08:10:35 2010 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\diasymreader.dll
        60650000 4ba1db8f Mar 18 03:51:43 2010 C:\WINDOWS\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll
        61750000 4ba1e064 Mar 18 04:12:20 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Data\92cccedc7cda413ff6fc6492cb256b58\System.Data.ni.dll
         4e00000 4ba1e064 Mar 18 04:12:20 2010 C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
        71c00000 45d70ae9 Feb 17 09:02:17 2007 C:\WINDOWS\system32\WS2_32.dll
        71bf0000 45d70aea Feb 17 09:02:18 2007 C:\WINDOWS\system32\WS2HELP.dll
        761b0000 45d70a80 Feb 17 09:00:32 2007 C:\WINDOWS\system32\CRYPT32.dll
        76190000 45d70aac Feb 17 09:01:16 2007 C:\WINDOWS\system32\MSASN1.dll
        766d0000 45d70abc Feb 17 09:01:32 2007 C:\WINDOWS\system32\shfolder.dll
        666d0000 4ba1e09d Mar 18 04:13:17 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Transactions\dd9dbf82e44454689976a49a9e4ddb6d\System.Transactions.ni.dll
        66680000 4ba1e09d Mar 18 04:13:17 2010 C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll
        65d70000 4ba1df90 Mar 18 04:08:48 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\8b6e9d6171aad3561263ce2cd05c57df\System.EnterpriseServices.ni.dll
        10020000 4ba1db80 Mar 18 03:51:28 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\8b6e9d6171aad3561263ce2cd05c57df\System.EnterpriseServices.Wrapper.dll
        10000000 4ba1db80 Mar 18 03:51:28 2010 C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll
        71f60000 3e8024bc Mar 25 05:43:24 2003 C:\WINDOWS\system32\security.dll
        76750000 4a3742b4 Jun 16 02:59:00 2009 C:\WINDOWS\system32\schannel.dll
        76920000 45d70ac8 Feb 17 09:01:44 2007 C:\WINDOWS\system32\USERENV.dll
        71c40000 48f7bdc3 Oct 16 18:18:43 2008 C:\WINDOWS\system32\NETAPI32.dll
        48060000 434f63fa Oct 14 03:53:30 2005 C:\Program Files\Microsoft SQL Server\90\Shared\instapi.dll
        78130000 4889d619 Jul 25 09:33:13 2008 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_B80FA8CA\MSVCR80.dll
        68100000 45d6978b Feb 17 00:50:03 2007 C:\WINDOWS\system32\dssenh.dll
        66230000 4ba1dfda Mar 18 04:10:02 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Numerics\b07f0d26a34ad53fc369248f289d1126\System.Numerics.ni.dll
        66510000 4ba1df78 Mar 18 04:08:24 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Security\09a97525ae5583cc2685e2c39a3078bd\System.Security.ni.dll
        7b1d0000 4ba1e086 Mar 18 04:12:54 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Drawing\dd57bc19f5807c6dbe8f88d4a23277f6\System.Drawing.ni.dll
        68df0000 4ba1e1a5 Mar 18 04:17:41 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Web.Services\149f2dcb9c9706e592d1980a945850c2\System.Web.Services.ni.dll
        51860000 4ba1f498 Mar 18 05:38:32 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.ServiceModel\250b525aa8c17327216e102569c0d766\System.ServiceModel.ni.dll
        66610000 4ba1e143 Mar 18 04:16:03 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.ServiceProce#\6e7f1bdc845816dfc797f8002b76b5e8\System.ServiceProcess.ni.dll
        52d30000 4ba1f585 Mar 18 05:42:29 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.ServiceModel#\51c60db370e050d9cdcac17060aaac53\System.ServiceModel.Web.ni.dll
        51130000 4ba1f437 Mar 18 05:36:55 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Runtime.Seri#\e9f8a45b1063d6c6a62718c88a5623d1\System.Runtime.Serialization.ni.dll
        63d00000 4ba1e082 Mar 18 04:12:50 2010 C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\System.Data.OracleC#\db33744fb49e77c7233adb50f07fe62a\System.Data.OracleClient.ni.dll
        63c80000 4ba1e082 Mar 18 04:12:50 2010 C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Data.OracleClient\v4.0_4.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll

Memoru Usage

$
0
0
If i add library or class or name space or DLL or any component  into a program then whats happens either Operating System copy and paste all the properties and methods of the mentioned (library or class or name space or DLL or any component) into current program or just call the properties and methods from other program block.

salman


how to install visual basic 6.0 to windows 8.1

$
0
0

plz help I want setup vb6.0 into win8.1

I lovw it vb6.0 and also win8.1

Memory Usage

$
0
0
If i add library or class or name space or DLL or any component  into a program then whats happens either Operating System copy and paste all the properties and methods of the mentioned (library or class or name space or DLL or any component) into current program or just call the properties and methods from other program block.

salman




Debugger for lamda expression

$
0
0

Hi, Could anyone let me know how can I debug lamda expression .. is there any tool which allow me to see the expression and details during run time? 

Thanks,

PT

ResolveEventHandler issue when migrating from .NET 3.5 to 4.0

$
0
0

Hi,

We are moving to .NET 4.0. Our application is using ResolveEventHandler to load the proper assemblies (based on some XML files, so we could have multiple versions).

We do not have separate resources - all is embedded in the executables/dlls.

We have got a nice "AppName.resources" file-not-found exceptions when the resources are to be loaded.

What I figured out was that that from .NET 4.0 this delegate is called back for RESOURCE assemblies as well -  so getting this exception is a kind of "feature" [http://msdn.microsoft.com/en-us/library/system.resolveeventhandler(v=vs.100).aspx]

The questions here are:

1. Why the delegate is called with the "AppName.resources" file at all? [OK, it should be because this way locale-specific applications can decide what to load]

2. What assembly to return if the is no separate assembly at all [e.g. resources are embedded in the executable]?

3. Is it just sheer luck that returning the assembly where the delegate's code is, works?

4. Returning the assembly of where the resource really is does not work. Why? Is there any explanation to this? 

Thanks in advance

-seci




Extend C# language feature

$
0
0

if we see Linq syntax in C# we will meet many of them specify property of an object, like below

from o in db.Orders where o.OrderID = 3 select o;

My question is simple, how we know what property/field beside method is specified by the code ?

Suppose you have a method with some parameters like below

public void MyMethod(int x) {}

and invoked by user like MyMethod(MyObject.MyProperty);

Is possible we know what acctually passed to the method (what property/field of an object), not just the value itself ?

Yes it is possible using delegate, but delegate is for a method. Is there same like delegate but for field or property ?



It's hard to be advanced programmer

some assemblies are mapped twice.....

$
0
0

Hi,

I have noticed using the ProcXP (VMMap) that some ASP.NET applications (.NET 4)
load (maps?) some assemblies twice or more.

I use VS 2010 (W7 x64), with the AnyCPU option and tested in 2008 R2 x64 server....the apps are both complied with release/debug options, the result it's the same.

This "problem" can be build with any "blank" (read default) ASP.NET application.

here some examples:

ProcXP images



Could anyone let me know why the assembly are mapped twice (or more), there is a reason ???

PS

if you need, I can provide the blank/default application sample :).

Thx




Dynamic Assembly Loading / Unloading

$
0
0

 

     Hi everyone. Let me start off with a few basic statements. I am in no way new to MSDN; however, I have never posted on the forums. I usually like to stay low and see what other people have said or think. I tend to develop a lot of applications anywhere from controls applications (Microcontrollers) to .NET applications. Anyhow.. here is my discussion topic.

I am in no way here to start another "OMG, how do I unload assemblies in the current app domain" question or topic, so anybody who reads what I am about to propose, and says its impossible, please refrain from posting. I am seriously sick of hearing all of the "its impossible" talk. I am a person who tends to try and take the impossible and make it possible. With that said, I have recently come upon the need for unloading assemblies in the current app domain. Loading assemblies in another app domain and unloading it when not using them will not cut it, nor does trying to pass object between domains cut it. For example, one of the applications is dynamic loading / unloading WPF plugins via assembly dlls and making the UI extensible. Now.. we can try to apply the seperate app domain for every plugin approach to this situation, but for one... there are remoting issues. For two, it is my understanding that each app domain starts its own thread / UI thread (WPF app domain plugin), therefore if there were tens of plugins... you would have tens of UI threads. Extremely wasteful. There is no easy way to copy objects by reference to other app domains either using remoting or not using it.

Where am I going with this? Well.. in .NET4, Microsoft introduced collectible assemblies. These things allow you to define a dynamic assembly at runtime using reflection emit. So technically I can load and unload an assembly in the same app domain! Exactly what I want. Quick and easy. Whats the catch? Oh yeah.. Microsoft forgot to put in a LoadFromAssemblyFile function. This means if I already have compiled code, say from a WPF plugin that someone made (.dll file), I have no way of loading it in the dynamic assembly I just created. How to solve this issue? I have looked at many many things, and they are either impossible to do because the CLR is not open source, or they are just too time consuming. I would be an old fool by the time I got something working. Well.. I didnt just decide to post this message here intending to say "its impossible". The third option is:

Writing an assembly CLR PE loader. I am currently undertaking the task of writing such a loader that will parse a pure IL CLR .dll assembly file. The loader will parse namespaces, classes, fields, etc. and load them into the dynamic assembly. Once the dynamic assembly is loaded, it can be used just like any other dynamic assembly that is loaded at runtime. Wouldn't it be awesome if you could write the following code?:

 

 

using System;using System.Awesome;using System.Reflection;using System.Reflection.Emit;namespace Program
{publicclass AppStart
 {publicstaticvoid Main(string[] args)
 {int result = 0;// Load dynamic assembly from filename TestAssembly.dll// in same directory as this application.
 DynamicAssembly assembly = DynamicAssembly.Load("TestAssembly");// Call a static function in the assembly.// This function is a static function that adds two numbers// and returns the result.
 result = (int)assembly.Execute("Test.TestClass.AddTwoNumbers", newobject[] { 42, 77 });// Print out the result and the current assemblies// in this application domain
 Console.WriteLine(result);
 PrintAssemblies();// Let us now UNLOAD the assembly
 DynamicAssembly.Unload(assembly);
 Console.WriteLine("\n\n");// Print out the new list of assemblies in the// application domain
 PrintAssemblies();
 }privatestaticvoid PrintAssemblies()
 {
 Assembly[] assms = AppDomain.CurrentDomain.GetAssemblies();foreach (Assembly a in assms)
 {
 Console.WriteLine(a.GetName().Name);
 }
 }
 }
}

 

Here's a screen of that code running.http://postimage.org/image/vho0yu04/. Of course... as of right now, the add function is "virtually implemented". That code is not loaded from the assembly file. Additionally, "Dynamic Assembly" in the list refers to the running application exe, which is named Dynamic Assembly. This is simply a unit test. I'm not done with the PE loader. Anyhow... I believe that it should be and is possible to do something of this nature. Again, this would support PURE .NET IL assemblies. I'll be damned if I am going to dabble in mixed or native assemblies. So... I would like to hear people's CONSTRUCTIVE thoughts on this subject. If you plan on attacking me outright for whatever reason.. (I have had that experience more than once, because I post so little), do not bother posting. I realize that it will take time and effort to perfect.

 

 LostTime77



 




Find a way to know if the oleacc.dll is working as expected or not

$
0
0

Hi All,

I have an application that will use oleacc.dll to grab the other running windows application text.

Basically, I have used these two functions of oleacc.dll

AccessibleObjectFromWindow

AccessibleChildren

If I delete a registry entry (eg. HKLM\SOFTWARE\Classes\Wow6432Node\TypeLib\{1EA4DBF0-3C3B-11CF-810C-00AA00389B71})  related to Oleacc.dll then these functions work without throwing exception but not giving the expected result. And the end result is the application is running but not doing the expected work.

So, I wanted to know if there is any way to find if the oleacc.dll (Microsoft accessibility) is working as expected or not. 

Thanks

Prakash


pkt30

How do I open / run Cognos Impromptu Report from CSharp

$
0
0

Hi,

I am new to Csharp and using C# for my application development and I need to load Cognos Impromptu application and run a report from my application automatically and run the report to create ascii text file. Is there any code is available? I have vb.net code but I do not know how to write it is in C#. If you have please send me, your help is really appreciated.

for your reference I am sending vb.net code, I need the below code in CSharp.

Call Cognos("C::AccountsPayable DOWNLOAD.IMR", "c:\APDownload.txt")

Function

Private Sub Cognos(ByRef StrReport As String, ByRef StrText As String)

        Dim objImpApp As New Object
        Dim objImpRep As New Object
        objImpApp = CreateObject("CognosImpromptu.Application")

        'Open Impromptu catalog
        objImpApp.OpenCatalog("C:\Program Files\cognos\cer5\Deltek\IMP74GCSP41\Catalog\All Tables.cat")
        'Open the report that will be exported to text format
        objImpRep = objImpApp.OpenReport(StrReport)
        objImpRep = objImpApp.ActiveDocument
        ' objImpRep.ExportAscii(StrText, , -1) 
        objImpRep.ExportAscii(StrText, 0, -1, , 0)
        objImpRep = Nothing
        objImpApp = Nothing
        MsgBox("Cognos Done")

    End Sub

Thanks


Reg : Browser independent solution for accessing smart cards.

$
0
0

Can you suggest me with browser independent method of accessing smart card. As i know activex works only in internet explorer.And i haven't tried silverlight but i think it has sandbox model so even it restricts to access operating system resources(smart card resource manager,PCSC library). Please suggest me solution for making it into browser independent. 

As far as i know there is no .Net library for accessing smart card . PCSC library (In windows OS) is the only way of accessing smart card. But how to access this resource from the web. Please guide me in this issue.

I dont know whether this is the correct forum for asking this question . I have searched almost every forum i am unable to understand where to ask this question. If this is not the correct forum please tell me where can i post this question.

Thanking you,

Pavan 

PtrToStructure failed to copy bytes if struct contains Boolean inside

$
0
0

I have following code

      static byte[] testBytes2 = { 49, 56, 58, 0, 123, 0, 0, 0, 1, 1, 1 };

      [StructLayout(LayoutKind.Explicit, Pack = 1)]
      internal unsafe struct fields_test
      {
         [FieldOffset(0)]
         public fixed byte a0[4];
         [FieldOffset(4)]
         public System.UInt32 a1;
         //[FieldOffset(8)]   // if you uncomment these lines variable a0 will not be filled!! only one byte will be copied!
         //public System.Boolean a2;
      }; 

      GCHandle handle = GCHandle.Alloc(testBytes2, GCHandleType.Pinned);
      fields_test test = (fields_test)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(fields_test));
      handle.Free();

When you run it, bytes will be copied to structure correctly. BUT. If you uncomment last 2 lines, essentially adding one Boolean in the end of struct, first byte[] will not be filled with values anymore!!! only one byte will be copied!!

This seems like a bug inside PtrToStructure function !!!

here is result of first run:

test.a0 == [49,56,58,0 ]
test.a1 == 123

here is result of second run:

test.a0 == [49,0,0,0 ]
test.a1 == 123
test.a2 == True

Unable to see results of updated/reregistered DLL Assembly when using REGASM.EXE

$
0
0

Hello,

I have a C# COM Interop managed solution.

I used "regasm /tlb:DatePickerLib.tlb DatePicker.dll /Codebase" to register the DLL the first time and the calling client worked fine.  It executed the assembly and I saw the results of my C# program.

When I made a change to my C# COM Interop managed solution, I did the following:

C:\Users\Tony\Documents\Visual Studio 2013\Projects\DatePicker\DatePicker\bin\Debug>regasm /u /tlb:DatePickerLib.tlb DatePicker.dll
Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.33440
for Microsoft .NET Framework version 4.0.30319.33440
Copyright (C) Microsoft Corporation.  All rights reserved.

Types un-registered successfully
Type library 'C:\Users\Tony\Documents\Visual Studio 2013\Projects\DatePicker\DatePicker\bin\Debug\DatePickerLib.tlb' un-registered successfully

C:\Users\Tony\Documents\Visual Studio 2013\Projects\DatePicker\DatePicker\bin\Debug>


I then reregistered it using:

C:\Users\Tony\Documents\Visual Studio 2013\Projects\DatePicker\DatePicker\bin\Debug>regasm /tlb:DatePickerLib.tlb DatePicker.dll /Codebase
Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.33440
for Microsoft .NET Framework version 4.0.30319.33440
Copyright (C) Microsoft Corporation.  All rights reserved.

Types registered successfully
Assembly exported to 'C:\Users\Tony\Documents\Visual Studio 2013\Projects\DatePicker\DatePicker\bin\Debug\DatePickerLib.tlb', and the type library was registered successf
ully

C:\Users\Tony\Documents\Visual Studio 2013\Projects\DatePicker\DatePicker\bin\Debug>


As you can see, none of those gave any errors and it said it was "Successful".

When I rerun my client consuming unmanaged program, It gives the same results from my original C# COM Interop managed program that I got when I first installed it.  It does not show the changes I made to my C# COM Interop managed program.

I have tried deleting all temporary files and restarting my computer.

Does anybody know how to update an already registered assembly?

Any help would be gratefully appreciated.

Thanks,
Tony


Stop The World, I want To Get Off! ........... Life Isn't About Waiting For The Storm To Pass ... It's About Learning To Dance In The Rain.






Satellite assembly is loaded, but the strings are still in English

$
0
0

I have a WPF application with .resx resource file. I use resgen and AL.exe to get the satellite assembly and the English strings are embedded in the exe itself. I'm trying to test if localization is working or not.

I added code in App.xaml.cs to set CurrentCulture and CurrentUICulture to tk-TM and placed the satellite assembly under .\tk-TM folder.

This is the output from FUSLOGVW, which shows that it is successfully binding to the satellite assembly. But the text is always in English. I wanted to eliminate the case of satellite assembly also having English strings and recompiled the EXE with different strings expecting to see the old version of strings in the satellite assembly. But I see that the satellite assembly binding is successful and the embedded new version of strings being displayed.

LOG: This bind starts in default load context. LOG: Using application configuration file: D:\office\enduser\sconline\UI\Site\bin\NDESConnectorUI.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: NDESConnectorUI.resources, Version=5.0.0.0, Culture=tk-TM, PublicKeyToken=31bf3856ad364e35 LOG: GAC Lookup was unsuccessful. LOG: Attempting download of new URL file:///D:/office/enduser/sconline/UI/Site/bin/tk-TM/NDESConnectorUI.resources.DLL. LOG: Assembly download was successful. Attempting setup of file: D:\office\enduser\sconline\UI\Site\bin\tk-TM\NDESConnectorUI.resources.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: NDESConnectorUI.resources, Version=5.0.0.0, Culture=tk-TM, PublicKeyToken=31bf3856ad364e35 LOG: Binding succeeds. Returns assembly from D:\office\enduser\sconline\UI\Site\bin\tk-TM\NDESConnectorUI.resources.dll. LOG: Assembly is loaded in default load context.

1. Is there a way to look into the actual strings stored inside the satellite assembly?

2. How to troubleshoot why the localized strings are not being shown even when binding is successful?

Thanks!

About the extended support for .NET Framework 3.5 SP1 as a OS Component

$
0
0

According to the Microsoft .NET Framework Support Lifecycle Policy FAQ (http://support.microsoft.com/gp/framework_faq?wa=wsignin1.0), .NET Framework 3.5 SP1 is still being supported as an OS component.

Since .NET Framework 3.5 SP1 is still being supported in most of the OS, will the instance of .NET Framework 3.5 SP1 also receives security update/hotfix when it installed under Windows XP?

Viewing all 1710 articles
Browse latest View live


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