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

Maximum Number of Processor Cores in CLR (VS 2013, Server 2012)

$
0
0

I found another thread on this subject from 2010, but it gave the appearance of having been resolved in 2010. So, it is unclear to me why I would still be seeing my CLR programs limited to using 32 logical processors on a Windows Server 2012 with 48 logical processors.

Forums/vstudio/en-US: "Maximum Number of Processor Cores in CLR"

I wrote the following dumb C# program to test whether my program written in C# actually had access to all 48 logical processors, since it appeared to be more restricted in processor use than when I was running the same processing using multiple processes.

    class Program
    {
        static void Main(string[] args)
        {
            var threads = new Thread[100].Select(t => new Thread(() =>
            {   for (;;) Math.Max(int.MaxValue, int.MinValue); })).ToArray();
            Array.ForEach(threads, t => t.Start());
        }

    }

Which produces the following Task Manager plots on our Windows Server 2012 with 2 x Intel Xeon processors with 24 cores and 48 logical processors.

<unfortunately, not allowed to include images>

It is pretty easy to see from the screenshot (not included) that only 32 out of 48 processors are in use by the program (at 100% utilization), resulting in around 75% processor utilization. The effect is the same with any number of threads greater than or equal to 32.

Is there any way that I can fix this program or the system on which it is running to make user of all 48 logical processors within a single process?


Side-by-side problem when trying to run new x64 executable from Project

$
0
0

I have a main VS2008 C++ project that has several dll dependencies from other VS2008 projects.  Normally it is all done as Win32.  I want to move to x64.

The other dependencies have been compiled for x64, and the project references in the main project have all been switched to the x64 dll's.

The main program compiles ok as x64.

When I try to run the executable I get this error (copied from the system event log):

"Activation context generation failed for "c:\Users\*\Documents\Visual Studio 2008\Projects 2008\myapp\x64\Debug\myapp.exe". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis."

What am I doing wrong?

Replacement of CAPICOM Setsecret API in C#

$
0
0

Hi All,

     We were using CAPICOM API for encryption and decryption. now we are planning to upgrade with C# application and replace CAPICOM component.

CAPICOM code:

IEncryptedDataPtr encryption(__uuidof(EncryptedData));
HRESULT hr = encryption->SetSecret("SQOSDKD232WSDW", CAPICOM_SECRET_PASSWORD);
_bstr_t localcontent = ((_bstr_t)"CREATE A SAMPLE APPLICATION");
encryption->GetAlgorithm()->PutName(CAPICOM_ENCRYPTION_ALGORITHM_3DES);
hr = encryption->put_Content(localcontent );
_bstr_t encrytpedcontent = encryption->Encrypt(CAPICOM_ENCODE_BASE64);

We are thinking to upgrade above CAPICOM code in C# because CAPICOM is going to deprecate. but unable to understand how can we upgrade. because we have used below mentioned code to upgrade in C#. but during decryption we are getting error "wrong key" used to access data. i think the key we used to access data during encryption is wrong.

http://www.codeproject.com/Articles/1967/Encryption-Decryption-with-NET

Please help me.

Thanks

How to get method variables with reflection

$
0
0

I built a scripting application with a code editor that has an intelli-sense like feature.

Using reflection I can perfectly get types, properties, methods and fields.

However, I can't find a way to get variables' name and type declared inside a method and I wonder if it was possible at all with reflection ? Apparently MethodInfo returned by GetType.GetMethod() does not deliver this functionality.

Any ideas please ?

pdb files in release mode

$
0
0

Hi all,

 

I'm publishing a .net 2.0 solution under Visual Studio 2005 in Release Mode and when I check the folder "bin" where the files are published I can see a pdb file for each dll: I thought pdb files were only generated with debug mode: isn't that right??

 

2nd question by the way: does anyone know what happens to all the .cs files when published with option "only files needed to run the application"? Are they all in the single dll with the solution name that I see in the bin folder?

 

Thanks for your support if any!

 

idel

Unloading mixed mode DLLs

$
0
0
We cannot unload a mixed mode C++/CLI DLL with neither FreeLibrary nor AppDomain.Unload.

The scenario is like this: We have a C++ unmanaged exe that loads a mixed mode C+/CLI DLL. First we loaded the mixed DLL using LoadLibrary and then later unloaded the DLL with FreeLibrary. The DLL loads correctly and we can call exported methods in the mixed DLL than inside the mixed DLL calls managed code, other mixed mode DLLs and unmanaged DLL as well. However we found that the mixed DLL was not fully unloaded after calling FreeLibrary, preventing us from calling LoadLibrary again with success.

We found out that we probably needed to Load and Unload the mixed DLL using an AppDomain. Why we made a new proxy mixed DLL between the c++ unmanaged exe and the mixed DLL. This proxy DLL created an AppDomain and loaded the mixed DLL in that AppDomain. We expected the mixed DLL to be correctly unloaded after the AppDomain was unloaded, but this was not the case.

Investigating the case we discovered if we replaced the mixed DLL with a pure managed DLL, it could be correctly unloaded, why the problem must be the mixed mode nature of the DLL. We read that static and global methods and variables was loaded into the default AppDomain in mixed mode, why it was not fully unloaded together with the created AppDomain. We found a compiler declaration called __declspec(appdomain) to force the methods into an AppDomain, but we have many static and global variables and methods, making this option difficult. There should be a compiler warning C4398 indicating the places in the code where this should be added, but we newer succeeded in getting this warning displayed using VS2008.

Can it really be true that it is NOT possible to load and unload a DLL using mixed mode C++/CLI ? If somebody knows a solution to this problem we would really appreciate.

-cpede

renaming app.config or referring it from subfolder

$
0
0

We have decided to upgrade our project from .NET 4.0 to 4.5.2 but want to keep support of .Net 4.0 as it is.

So we have created copy of each CSPROJ file in the same directory one for 4.0 and and other for 4.5.2, but they are referring to same app.config file. 

How can I have 2 app.config files for each project?

COMPlus_InteropValidatePinnedObjects regression in .NET 4.6.1?

$
0
0

We have the following situation:

  • Server GC enabled
  • COMPlus_InteropValidatePinnedObjects enabled
  • .NET 4.6.1 was rolled out to 500+ machines over the weekend
  • 600+ uploaded crashes within 4 days

As such, we have had a very high volume of crashes with the following stack trace:

clr!SVR::seg_mapping_table_segment_of
clr!SVR::gc_heap::find_segment
clr!SVR::GCHeap::NextObj
clr!StubHelpers::ValidateObjectInternal
clr!StubHelpers::ProcessByrefValidationList
clr!CNameSpace::GcStartWork
clr!SVR::gc_heap::garbage_collect
clr!SVR::gc_heap::gc_thread_function
clr!SVR::gc_heap::gc_thread_stub


In nearly all of these crashes, I observe 1 or more threads that are in the middle of PInvoke calls.  When inspecting the dump, the address of the object passed to seg_mapping_table_segment_of is pretty much trashed.  Some of the PInvoke calls are from our code and suspect, however, there are a significant number that are largely from the .NET Framework.  Is it possible that the Server GC optimizations in .NET 4.6/4.6.1 resulted in a regression with this validation check?

Looking at the ref source, the following stands out:

ProcessByrefValidationList() - does not hold the lock guarding the entries/index

StubHelpers::ValidateByref() - locks while adding the entries and potentially growing the buffer




pinvoke and enum

$
0
0

Hi,

I need some help with passing enum from C# to C dll function in a pinvoke call. How can this be done correctly?

Thanks!

Repair General electric 0235710008 & 01207619993 وكيل جنرال الكتريك

$
0
0

Repair General electric  0235710008 & 01207619993 

Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993  Repair General electric  0235710008 & 01207619993 

Keyboard access from a windows service

$
0
0

Hi,

does anyone know if it is possible to make events for keyboard, or just to access to keyboard from a windows service (written in .net) ? I used to do it with winform references, but of course it is not possible in a service... I don't know anything about windows api, and I haven't found anything in the doc yet (which is not very surprising).

Thanks for your answer,

Romain

(and sorry for the bad english, which is not my native language)


Romain

Fast capture stack trace on windows / 64-bit / mixed mode

$
0
0

Asking same question as in here:

http://stackoverflow.com/questions/34501602/fast-capture-stack-trace-on-windows-64-bit-mixed-mode

You can reply either here or on stackoverflow - no matter where.

OutOfMemoryException

$
0
0

Dear Support,

We are having a website hosted on Windows Server IIS 7.5

Suddenly in past one month we are getting "OutOfMemoryException" every now and then in the same code which was working fine since many years.

On further investigation we have found that it usually comes when application does some heavy task in the memory like writing a huge file using FileStream or loading a BMP image into memory etc.

We have no clues what has happened on the server.

Please see the server & application details below and advise :

Server Configuration

-----------------------------

Windows Server 2008 R2 Standard Edition (64 Bit) (Service Pack 1)

Installed Memory 64 GB (32 GB usable)

IIS 7.5

ASP.net Application Configuration

---------------------------------------

Pool : ASP.Net 4.0 

Enable 32 bit applications : True

Managed pipeline mode : Classic

Private memory limit (KB) : 4194304

Virtual memory limit (KB) : 4194304

Thanks,

WFX Support Team

Reg. Framework 4.5.2 update

$
0
0

Hi,

We have web application compiled using .NET framework 4.5. Application is running fine in the production. However, since support ended from MS(https://blogs.msdn.microsoft.com/dotnet/2015/12/09/support-ending-for-the-net-framework-4-4-5-and-4-5-1/) for 4.5, we need to install 4.5.2 on the server. As I understand everything will work fine after 4.5.2 install.

Question is- what is recommended approach?-, do I need to uninstall 4.5 and then install 4.5.2 on top of the 4.0 base framework? Or just installing 4.5.2 on top of the current 4.5?

Also, since the link above says all three versions (4,4.5 and 4.5.1) support is ended, what is the base version which is supported by MS on top of which 4.5.2 runs?

Thanks,

Ram

clr exception 0xc0000409

$
0
0

My app crashed with an exception 0xc0000409. I use procdump.exe to generate a crash dump file. and found the faulting thread has the following stack trace:

ChildEBP RetAddr  
072cf04c 71d1df7c clr!__report_gsfailure+0x17
072cf054 71d1db94 clr!CrawlFrame::SetCurGSCookie+0x2d
072cf070 71d1d898 clr!StackFrameIterator::Init+0x60
072cf344 71d1d9cc clr!Thread::StackWalkFramesEx+0x62
072cf678 71db1946 clr!Thread::StackWalkFrames+0x9d
072cf6ac 71eaf56e clr!CNameSpace::GcScanRoots+0x101
072cf6f0 71eaf6db clr!WKS::gc_heap::background_mark_phase+0x3fc
072cf720 71eaf0e2 clr!WKS::gc_heap::gc1+0xac
072cf740 71eaf010 clr!WKS::gc_heap::bgc_thread_function+0x128
072cf744 71ea36f8 clr!WKS::gc_heap::bgc_thread_stub+0x3c
072cfe60 770e86e3 clr!Thread::intermediateThreadProc+0x4d
072cfe6c 77d8bf39 kernel32!BaseThreadInitThunk+0xe
072cfeb0 77d8bf0c ntdll!__RtlUserThreadStart+0x72
072cfec8 00000000 ntdll!_RtlUserThreadStart+0x1b

My app is targeting .net 4.0 client profile. the clr.dll version is 4.0.30319.18449. The system is Windows 8 Pro. I have been able to duplicate this issue on Windows 7 as well.



App Crash with CLR20r3

$
0
0

Every time I start my application, the application crash and I can see the following problems in the event viewer.

Problem signature:

Problem Event Name: CLR20r3

Problem Signature 01: cadtest.exe

Problem Signature 02: 1.0.0.0

Problem Signature 03: 5011ecaa

Problem Signature 04: CADTestService.service

Problem Signature 05: 1.0.0.0

Problem Signature 06: 505011ecaa

Problem Signature 07: 8e

Problem Signature 08: 1f1

Problem Signature 09: System.AccessViolationException

OS Version: 6.1.7601.2.1.0.256.48

Like that.

I search the error on google and found many similar threads, but none of them helps, can you give me some suggestions on that? Thank you very much.

Unable to launch my windows App in windows 10 machine

$
0
0

i have some problem with windows 10 machine, my Windows application is developed using C#,C++,mfc and winForms. So currently i am using win 7 machine and i am able to launch my App there is no issues with this machine.

But in win 10 while Double clicking on my .exe it's not opened and did not get any error msg...i don't know how can i trace this thing. here what i observed is while comparing .net frameworks in win 7 and 10 machines in win 7 i have .net framework 3.5(include 2.0 and 3.0) but in win 10 i have .net framework 4 onwards so i just installed framework 3.5(include 2.0 and 3.0) it's working fine.

then i opened .csproj xml files there is a line called `<TargetFrameworkVersion>` it is targeting v4.0 and here we have some lines which are pointing to references

</Reference><Reference Include="System" /><Reference Include="System.Data" /><Reference Include="System.Design" /><Reference Include="System.Drawing" /><Reference Include="System.Runtime.Remoting" /><Reference Include="System.Windows.Forms" /><Reference Include="System.Xml" /><Reference Include="System.Core"><RequiredTargetFramework>3.5</RequiredTargetFramework></Reference><Reference Include="System.Xml.Linq"><RequiredTargetFramework>3.5</RequiredTargetFramework></Reference><Reference Include="System.Data.DataSetExtensions"><RequiredTargetFramework>3.5</RequiredTargetFramework></Reference>`

so, here i have some issues:

I have some more references which are pointing to 2.0 and 3.0 as well,

can i change 2.0,3.0 and 3.5 to 4.0?
those references will support in 4.0?

or

any solution to work my app in win 10?

<BootstrapperPackage Include="Microsoft.Net.Client.3.5"><Visible>False</Visible><ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName><Install>false</Install></BootstrapperPackage><BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"><Visible>False</Visible><ProductName>.NET Framework 3.5 SP1</ProductName><Install>true</Install></BootstrapperPackage>

The above one is in framework 3.5 it should be in 4.0 or  nothing?

if it should be in .net framework 4.0, how can i replace those things?

help me out this.

Thanks in advance.

Sorry for my poor english.

Program crashes on startup, but works when moved to another folder.

$
0
0

I've got a whacky situation that I can't seem to figure out.  We have a distributed client/server application written in C# using .Net 2.0.  It runs fine...for days, for weeks, everything is pee-chee.  This is on Windows XP Pro, SP2, btw.  Then, suddenly, one day, the application won't run.  It crashes on startup.  I can't even begin to debug it because it seems the system has crashed the application before the client entry point.

 

The application will fail to run indefinitely.  Until...get this...until I move the program to another directory.  Without rebuilding the application, without changing the .config files, without doing anything to the actual bits or configuration of the application, simply moving the assemblies to another folder (or more practically, simply renaming the parent folder) is sufficient to allow the application to start up and run again.

 

The users are running the application under a "Limited User" account.  I suspect this to be an important tidbit of information.  And, as far as I can tell, all the permissions are set properly.  Nothing, as far as I can tell, changes wrt the folder/system permissions.  Even if I create a new folder with the same name/path as the crashing scenario, and reset all the permissions, etc. the application simply won't run.  If I just rename the last folder in the path to the application, then it will run again.

 

This smells like some sort of whacky permissions/security thing, or something.  But, I can't figure out why it will run for a period of time, and then suddenly stop.  Nor, can I figure out how to get the application to run again unless I rename the parent folder that houses the application assemblies.

 

Help?

 

Thanks,

-tedvz

NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Tried to start a service that wasn't the latest version of CLR Optimization service. Will shutdown

$
0
0

Hi everyone,

I have developed a .NET C# application using Visual Studio 2010 Ultimate running on a Windows 10 installation.

When I run the executable file, it runs good on Windows 10, Windows 8.1, Windows 7-64bit and also on Windows 2003 Server-64 bit, but when I run it on a Windows 7 32 bit it crashes. Cannot connect to database (I connect reading a xml file) and gives an Exception.

This is what I have found in the Event log:

--

Application: APPNAME.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.InvalidOperationException

Stack:

at System.Data.SqlClient.SqlConnection.GetOpenConnection(System.String)

at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(System.String, System.Data.SqlClient.SqlCommand)

at System.Data.SqlClient.SqlCommand.ValidateCommand(System.String, Boolean)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String, System.Data.Common.DbAsyncResult)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String)

at System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior, System.String)

at System.Data.SqlClient.SqlCommand.ExecuteReader()

at APPNAME.frmPrincipal.compruebaCarpetas()

at APPNAME.frmPrincipal..ctor()

at APPNAME.Program.Main()

.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Tried to start a service that wasn't the latest version of CLR Optimization service. Will shutdown

--

What can I do?? I'm completely desperate!! Should I install Visual Studio on a Windows 7-32bit and generate the executable file? Should I reinstall Microsoft .NET Framework 4 on all Windows 7-32 bit PC's?? 

Help me please!! Any suggestion will be appreciated...

Thanks.

Rachel.

Integrating IM app with outlook 2013 not working without Lync installation

$
0
0

I have developed a local IM application (IM APP) with the help of article "https://msdn.microsoft.com/en-us/library/office/jj900715.aspx", LyncSDk 2013, Lync basic 2013 & Outlook 2013.

It is working at development machine because environment is setup there. When it is running with different machine, outlook 2013 is not responding to IM APP with functions GetAuthenticationInfo(), GetInterface() etc of interface UCOfficeIntegration.

When Lync 2013 got installed at same machine than outlook is working well with IM APP. I again uninstalled it then again Outlook stop to send the request to IM APP. Microsoft.Office.UC.dll is part of office15 folder & registered with Microsoft.NET\Framework\v4.0.30319\regasm.exe.

I am not able to find out the issue & resolution. Please suggest.

Viewing all 1710 articles
Browse latest View live


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