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

ILASM versioning

$
0
0

Hello everyone,

I've got a question regarding the version of ilasm.exe as part of CLR 4:

The version number is different on Windows 8.1 and Windows 10 (both have .NET 4.6 installed). I checked the version number on both machines under C:\Windows\Microsoft.NET\Framework64\v4.0.30319.

The version under Windows 8.1 is 4.0 (which is what I would expect, since the CLR is the same accros .NET 4.*) but on Windows 10 it shows as 4.6. What is the difference between these two ilasm versions and why are they different?

Thanks everyone!



Unsigned assemblies and application running from NAS

$
0
0

I created an in-house utility program that we run from a NAS location. This program loads several unsigned DLLs at runtime (LoadAssembly). The program runs fine most of the time, but from time to time, a user will get a SystemAccessViolation exception (trace shows a call to StrongNameSignatureVerification as the last thing that happened).

I'm not sure exactly what is going on. Multiple users can be running the program. Like I said, the program runs most of the time.

 

Treatment of NULLS in .NET Framework 4.5

$
0
0

Hello

I've converted an application from .NET framework 3.5 to 4.5 and it appears NULLS are treated differently. Can any advise if this is correct and how it is different?

Thanks

Faulting module name: clr.dll

$
0
0

We are using .Net Framework 4.0 and while running the console app the application is throwing below the error and exiting with error code80131506.

"Faulting module name: clr.dll"

After restarting the console app it is running fine. This kind of failure is occuring once in a week. Please suggest how to fix it.

Pros and Cons of COM reference and DLL reference

$
0
0
I would like to know pros and cons of COM object reference and DLL reference.

Say,I'm writing a tool to do some operation with MS Excel, should i add the reference of the Excel in .Net tab or COM components tab of Add Reference dialog box.

In the below link,it was said like we can use Embed Interop Types property to embed the COM objects required in the referenced DLL.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/39edc2f3-781b-48c6-8e5f-f170ef00b10e/why-does-the-embed-interop-types-option-not-generate-the-appropriate-dispidattributes-in-some?forum=clr

How it will impact the application?

How to pass all arguments to a wrapper function in .NET Profiler with ILRewrite?

$
0
0

Hi ,

I want to make a profiler like New Relic's .NET agent, but I get some trouble.
The effect just like the output below.

a C# method like:
int Foo(int a, int b, int c)
{
    Console.Writeline("a={0}, b={1}, c={2}",a, b ,c);
    return (a+b+c);
}

when invoke Foo(1,2,3);
1.before injection output:
a=1,b=2,c=3

2.after injection output:
method(Foo) has three arguments:1,2,3.
 a=1,b=2,c=3
method(Foo)  return 6.

I have read 
https://msdn.microsoft.com/en-us/library/bb384493%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
http://www.codeproject.com/Articles/17275/Really-Easy-Logging-using-IL-Rewriting-and-the-NET
but I don't know how to pass all arguments.

Thanks a lot!


Delegate Caching Question

$
0
0
I have a question about delegate caching. Lets say I have this simple object:

public class MyObject { public MyObject() {} public void Speak( delegate Action<string> getString ) { Console.WriteLine( getString() ); } }

And I do this on it:

for( var i = 0; i < 1000; i++ ) myObject.Speak( () => i.ToString() );

By capturing the variable "i", it actually NEWs up 1,000 anonymous objects to store the value the "i" that gets captured by the closure at each iteration. Naturally I'd like to avoid this unnecessary allocation - why not just pass the "i" value via the stack instead?

So I do exactly that:

public class MyObject { public MyObject() {} public void Speak( int i, delegate Func<int,string> getString ) { Console.WriteLine( getString( i ) ); } }

for( var i = 0; i < 1000; i++ ) myObject.Speak( i, (closure) => closure.ToString() );

This is better. No more closures. Only one heap allocation to cache the delegate, and then the delegate gets reused. However, it's not generic, so if I want to call "speak" with something other than a single integer, I'm out of luck. So lets make it generic instead:

public class MyObject { public MyObject() {} public void Speak<C>( C closure, delegate Func<C,string> getString ) { Console.WriteLine( getString( closure) ); } }

for( var i = 0; i < 1000; i++ ) myObject.Speak( i, (closure) => closure.ToString() );

At first glance, it looks we still get to cache the delegate. OR SO IT SEEMS??? Maybe not: I came across this article: http://blogs.msdn.com/b/pfxteam/archive/2012/02/03/10263921.aspx

... and it seems that if a delegate has a generic in its signature, then in fact it will NOT cache the delegate, and instead heap allocate a brand new delegate for each call, even if it does not capture any variables! (This seems like a performance bug in the C# compiler, IMO.) Is my understanding accurate?

If so, is there a work-around to avoid these excessive heap allocations when dealing with generic delegates? Also, can I automatically detect these without a profiler? I can easily detect the creation of anonymous classes via Reflection, and this has allowed my tests to detect accidental variable capture within certain performance-critical loops, but I don't know how to detect non-cached delegates that do not capture (in the case of generic delegates).


Is there any hot fix for Windows 10 for CLR known crash issue

$
0
0

Hi everyone,

There is an known CLR crash issue like below:
Issue 8   
When you create native code for certain methods, the .NET Framework applications and NGEN processes may experience an unexpected crash.
For detail, please refer KB3139551
https://support.microsoft.com/en-us/kb/3139551

And, we already know there are hot fixes for other platform: 
KB3139550 Hotfix Rollup HR-1602 - NPD 4.6/4.6.1 RTM - Win8.1RTM/Win2K12R2RTM- 
KB3139549 Hotfix Rollup HR-1602 - NPD 4.6/4.6.1 RTM - Win2K12RTM - KB3139549

For detail, please refer:  Application crashes after .Net runtime upgrade to .Net4.6
https://social.msdn.microsoft.com/Forums/vstudio/en-US/98718292-b305-44a7-8042-d915b0484742/application-crashes-after-net-runtime-upgrade-to-net46?forum=clr&prof=required


We meet the issue and the hot fix 3139551 works fine on Win7. 
However, I cannot find any responding hot fix to resolve the issue on Win10.
And, anyone knows that when these hot fixes will be integrated into .Net release? 

Thanks a lot.



BRs,

Huiping




Multi Page Printpreview in vb.net

$
0
0

I'm trying to Show Multi Page in printPreview Dailog. Actually a Tablelayoutpanel1 have 12 row .Each Row have Radchart graph.So i want to print the whole Chart graph.

in below Code is Showing only one page . That one page contain 4 charts... i want 12 chart in one page or two page.. please give any idea to fix this.

using Btmp as Bitmap= New Bitmap (TabelpanelLayout1.width,TabelpanelLayout1.Height)

TabelpanelLayout1.DrawToBitmap( Btmp,New Rectangle(0,0,Btmp.width,Btmp.Height))
e.Graphics.DrawImage(Btmp,0,0)

End Using

I tried  e.Hasmorepages property has a true .The result , print Document Dialog box  is creating  more .( like 1,2,3,4,5.....)

Installing in mapped network drive.

$
0
0

Hi,

    I am developing an installer packege in VS 2005. One of our clients reported that he could not install our application in mapped network drive. One Unhandled exception "System.Security.SecurityException" is thrown. We investigated further and the issue can be resolved by changing the Trust Level of Local Intranet to full. But I want to know, if there is any way to resolve this issue using signing the assembly or any other  methods? How we can set zone or assembly Trust to full using signing? Please let me know your valuable suggestions....

Thanks!

Rathish P S.

X509Certificate2.PrivateKey fails even if HasPrivateKey == true

$
0
0

Hi,

I am trying to exercise the methods and properties of X509Certificate2 class as I wish to convert an application from .Net Framework 1.1 with its many P/Invoke and CAPICOM calls to a pure .Net app using .Net 2.0 improved certificate/crypto support.

I am playing with the MSDN C# sample app for X509Certificate2.PrivateKey Property with one small modification (suggested improvement )

Any thoughts why I get an exception

"System.Security.Cryptography.CryptographicException: Keyset does not exist"

on the line

Console

.WriteLine("Private Key: {0}{1}", x509.PrivateKey.ToXmlString(false), Environment.NewLine);

if I select a certificate that has an AT_EXCHANGE key associated.

If I select a certificate that has an AT_SIGNATURE key associated, then the code appears to run correctly and not throw an exception!

Note that the if (x509.HasPrivateKey)  is true which confirms that the selected certificate has a private key.

Also note that using .Net 1.1 and P/Invoke calls I can find the container name and then create a RSACryptoServiceProvider() object to use the private key of a cert associated with an exchange key.

Any suggestions would be appreciated.

Richard

 

using System;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.IO;
using System.Security.Cryptography.X509Certificates;

class CertSelect
{
    staticvoid Main()
    {
        try
        {
            X509Store store = new X509Store("MY",StoreLocation.CurrentUser);
            store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
            X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates;
            X509Certificate2Collection fcollection = (X509Certificate2Collection)collection.Find(X509FindType.FindByTimeValid,DateTime.Now,false);
            X509Certificate2Collection scollection = X509Certificate2UI.SelectFromCollection(fcollection, "Test Certificate Select","Select a certificate from the following list to get information on that certificate",X509SelectionFlag.MultiSelection);
            Console.WriteLine("Number of certificates: {0}{1}",scollection.Count,Environment.NewLine);
                foreach (X509Certificate2 x509 in scollection)
                {
                    byte[] rawdata = x509.RawData;
                    Console.WriteLine("Content Type: {0}{1}",X509Certificate2.GetCertContentType(rawdata),Environment.NewLine);
                    Console.WriteLine("Friendly Name: {0}{1}",x509.FriendlyName,Environment.NewLine);
                    Console.WriteLine("Certificate Verified?: {0}{1}",x509.Verify(),Environment.NewLine);
                    Console.WriteLine("Simple Name: {0}{1}",x509.GetNameInfo(X509NameType.SimpleName,true),Environment.NewLine);
                    Console.WriteLine("Signature Algorithm: {0}{1}",x509.SignatureAlgorithm.FriendlyName,Environment.NewLine);
                   

if

(x509.HasPrivateKey)

{

Console.WriteLine("Private Key: {0}{1}",x509.PrivateKey.ToXmlString(false),Environment.NewLine);
}


                    Console.WriteLine("Public Key: {0}{1}",x509.PublicKey.Key.ToXmlString(false),Environment.NewLine);
                    Console.WriteLine("Certificate Archived?: {0}{1}",x509.Archived,Environment.NewLine);
                    Console.WriteLine("Length of Raw Data: {0}{1}",x509.RawData.Length,Environment.NewLine);
                    X509Certificate2UI.DisplayCertificate(x509);
                    x509.Reset();
                }
            store.Close();
            }
        catch (CryptographicException)
            {
                   Console.WriteLine("Information could not be written out forthis certificate.");
            }
       
    }
}

.Net Profiler - JIT Compilation Callbacks not called in .Net Version 2.0

$
0
0

The profiler is getting registered and i am getting the ModuleLoadStarted and ModuleLoadFinished Callbacks in my profiler code. But For the same modules the JITCompilationStarted and any other JIT related functions are not getting called. 

I am not getting the callbacks for any System.* classes and methods which are in version 2.0 modules. 

But if i change the Application Pool version to 4.0 then i am getting the JIT callbacks to my profiler for the same web application and in the same machine.

What i am missing for the Version 2.0 and 32 Bit machine ? 

./Selva




.Net Profiler - How to do sampling .Net web applications

$
0
0

Hi,

Now i am following Instrumentation of .Net web applications which gives me some overhead .

How can i do this profiling by Sampling..? (Hope Sampling will not give much overhead to me)

Sampling too needs to be done in C++ or can be done in managed code itself ?

Where can i get some idea and examples on how to follow "Sampling " in profiling the .Net web applications.?

./Selva

Unable to use some APIs from a network drive, CASPOL does not seem to do the trick (Windows 7)

$
0
0

Hi All,

We are using Clearcase so our code is running from a network drive. 

Our client application is using C# UI and native code behind.

I recently upgraded my computer and moved to Windows 7 and for some reason am not able to run the client anymore from a network drive. 

Some debugging revealed that the native API getaddrinfo returns 11003, and I can't actually connect to our server. After doing some digging I found that running the client form another location (not a network drive) works. so I started looking at .net security issues.

I tried to narrow the problem and created a really small windows forms program which has one button that calls the following API IPAddress[] Addresses = Dns.GetHostAddresses("server") ; 

I copied the application code to both our network drive and the C local drive and got the same error (11003) when running from the network, while it worked perfectly when I ran it from the local drive.

The application is using .net framework 2, although I have 2,3.5,4 and 4.5 installed.

I tried to use caspol and edit the policy in all runtimes where it's available (2.0, 2.0 64bit, 4.0, 4.0 64bit) but no luck - I get the same results.

The outputs from CASPOL.exe are attached in the end of this message.

Can anyone tell me if I'm doing anything wrong or if there is anything else I can try...?

Thanks,

Ron

Caspol -listgroups:

32bit V2.0

Microsoft (R) .NET Framework CasPol 2.0.50727.5420

Copyright (c) Microsoft Corporation.  All rights reserved.


Security is ON
Execution checking is ON
Policy change prompt is OFF

Level = Machine

Code Groups:

1.  All code: FullTrust
   1.1.  Zone - MyComputer: FullTrust
      1.1.1.  StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C9
9921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F
17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: FullTrust
      1.1.2.  StrongName - 00000000000000000400000000000000: FullTrust
   1.2.  Zone - Intranet: FullTrust
      1.2.1.  All code: Same site Web
      1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
   1.3.  Zone - Internet: FullTrust
      1.3.1.  All code: Same site Web
   1.4.  Zone - Untrusted: FullTrust
   1.5.  Zone - Trusted: FullTrust
      1.5.1.  All code: Same site Web

32bit V4.0

Microsoft .NET Framework CasPol 4.0.30319.17929

for Microsoft .NET Framework version 4.0.30319.17929
Copyright (C) Microsoft Corporation.  All rights reserved.

WARNING: The .NET Framework does not apply CAS policy by default. Any settings shown or modified by CasPol will only affect applications that opt
into using CAS policy.

Please see http://go.microsoft.com/fwlink/?LinkId=131738 for more information.


Policy change prompt is OFF

Level = Machine

Code Groups:

1.  All code: FullTrust
   1.1.  Zone - MyComputer: FullTrust
      1.1.1.  StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C9
9921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F
17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: FullTrust
      1.1.2.  StrongName - 00000000000000000400000000000000: FullTrust
   1.2.  Zone - Intranet: FullTrust
      1.2.1.  All code: Same site Web
      1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
   1.3.  Zone - Internet: FullTrust
      1.3.1.  All code: Same site Web
   1.4.  Zone - Untrusted: FullTrust
   1.5.  Zone - Trusted: FullTrust
      1.5.1.  All code: Same site Web
Success

64bit V2.0

Microsoft (R) .NET Framework CasPol 2.0.50727.5420
Copyright (c) Microsoft Corporation.  All rights reserved.

Security is ON
Execution checking is ON
Policy change prompt is OFF

Level = Machine

Code Groups:

1.  All code: FullTrust
   1.1.  Zone - MyComputer: FullTrust
      1.1.1.  StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C9
9921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F
17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: FullTrust
      1.1.2.  StrongName - 00000000000000000400000000000000: FullTrust
   1.2.  Zone - Intranet: FullTrust
      1.2.1.  All code: Same site Web
      1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
   1.3.  Zone - Internet: FullTrust
      1.3.1.  All code: Same site Web
   1.4.  Zone - Untrusted: FullTrust
   1.5.  Zone - Trusted: FullTrust
      1.5.1.  All code: Same site Web
   1.6.  Url - file://v:\*: FullTrust
   1.7.  Zone - Intranet: MyCompany (LevelFinal)
      1.7.1.  StrongName - 0024000004800000940000000602000000240000525341310004000001000100ED92913322617BC45AAE29AAADDD29C1AF270797B200E698DA08CECEAA5
46F911AD09EF0F6DBE4221FA30B8210C76FE004702E540068E526273F35BD009D2026226D00AB72F4223B09E896C0F7AF688FAB2ADB4242C2BFDA793B5C2A259E0D6CD2BD09CBCC20305BD
465C113E36B19854602DC53CE4766F568FC576DBE3822B4: MyDepartment (Exclusive)

64bit V4.0

Microsoft .NET Framework CasPol 4.0.30319.17929
for Microsoft .NET Framework version 4.0.30319.17929
Copyright (C) Microsoft Corporation.  All rights reserved.

WARNING: The .NET Framework does not apply CAS policy by default. Any settings shown or modified by CasPol will only affect applications that opt
into using CAS policy.

Please see http://go.microsoft.com/fwlink/?LinkId=131738 for more information.


Policy change prompt is OFF

Level = Machine

Code Groups:

1.  All code: FullTrust
   1.1.  Zone - MyComputer: FullTrust
      1.1.1.  StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C9
9921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F
17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: FullTrust
      1.1.2.  StrongName - 00000000000000000400000000000000: FullTrust
   1.2.  Zone - Intranet: FullTrust
      1.2.1.  All code: Same site Web
      1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
   1.3.  Zone - Internet: FullTrust
      1.3.1.  All code: Same site Web
   1.4.  Zone - Untrusted: Nothing
   1.5.  Zone - Trusted: FullTrust
      1.5.1.  All code: Same site Web
Success

why does an assembly in the BIN folder get referenced at runtime from another assembly even though it was not included in project (but remained in build folder)

$
0
0

Hi there,

I solved this already after a day, but a) thought it might help others and b) wanted to (try to) understand WHY this happened and how I could have discovered it sooner.

I think this is fairly agnostic but just in case - CRM 2011 (7.0) and .NET 4.5.2 and Enterprise Library 5

So the deal was:

two projects, both referencing a common library that talked to CRM via the Generated (SDK) Microsoft.Xrm.Sdk.Client.CrmOrganizationServiceContext

this instance of this context is created in the CONTSTRUCTOR of the class library.

Anyway we USED EntLib 5.0 a while ago in this project but recently updated it to 6.0.

So we start getting this bizzare error from the constructor failing turning up in only ONE of our projects.

TypeInitializationException - The type initializer for 'Microsoft.Xrm.Client.Services.OrganizationServiceCache' threw an exception.

so we tried pretty much everything

fusion logs were all clean
project references were all good
because Unity was building everything it was failing in the buildup
one project you could step into everything the other you could not

Finally what caused us to go looking further afield was this info from Unity error in building things

At the time of the exception, the container was:


  Resolving CRMService,(none)
  Calling constructor CRMService(ILog logger, SmtpClient mail)
 -- Could not load type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Manageability.ConfigurationElementManageabilityProviderAttribute' from assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Anyway it turns out that in the local and source controlled directories there was an orphaned EntLib 5.0 file ( Microsoft.Practices.EnterpriseLibrary.Caching.Database.dll) that wasn't correctly deleted/removed from things in this project, and so was still being dropped everywhere, and so obviously was being used as the "local" (preferred, in the order of build/bindings) of the compiler, and for some reason (perhaps xrm.client uses entlib internally?) was interfering with the way things were working.

So we found the offending file, removed it from the source control folder and everyone is happy again!

So does anyone have any insights into how we could have discovered this without spending as much time as we did - process? tools? etc...

Thanks in advance.

 


- sure I'm noJedi but that's no reason to stop trying to make stuff levitate! -


Cngkey import not working for ECDSA

$
0
0

Hi,

I am trying to use the CngKey import and it gives me an exception.

I have a byte array of 64 bytes as my public key and I need to used it to verify an ECDSA signature received.

How will be this possible

if I use this sequence it works all the time.

 Dim dsa1 = New ECDsaCng(256)


            Dim publicKey = dsa1.Key.Export(CngKeyBlobFormat.EccPublicBlob)

            signature = dsa1.SignData(message)

            ' Dim crypto = New ECDsaCng(newKey)
            'Dim verify = crypto.VerifyHash()

            Dim key = CngKey.Import(publicKey, CngKeyBlobFormat.EccPublicBlob)
            Dim dsa = New ECDsaCng(key)
            dsa.HashAlgorithm = CngAlgorithm.Sha256

            If dsa.VerifyData(message, signature) Then
                MessageBox.Show("Verified")
                Return True
            Else
                MessageBox.Show("Not Verified")

                Return False
            End If

But I do not need to sign or export my current data. I need to verify a signature received using a known public key that is made as a byte array

I have my byte array and I even pad data to the array to meet the 72 byte format I see in when creating the key. Yet the program does not work and exemption occurs.

keyType = New Byte() {&H45, &H43, &H53, &H31}
keyLength = New Byte() {&H20, &H0, &H0, &H0}

keyImport = keyType.Concat(keyLength).Concat(publicKey_ax).Concat(publicKey_ay).ToArray

the publickey_ax and publicKey_ay contain the public key

newKey = CngKey.Import(keyImport, CngKeyBlobFormat.GenericPublicBlob) //this makes an exeption

Please help me find a solution. I am currently developing an ECDSA application and we cannot continue with this function broken.

Regards,

Aaron Arellano

Maxim Integrated Products

aaron.arellano@maximintegrated.com

UWP Release mode - .NET Native tool chain - Bad performance

$
0
0

Compiling the project in debug mode just works fine.
But for the store submission a release mode compiled version is required.

Therefore, I started to build my app in release mode and had to determine that the whole app is unusable, because of performance issues. After some try and errors I encountered that only if I enable "Build with .net Native tool chain" that problem occurs. I checked some forum posts here, and one said that maybe the wrong "Microsoft.Xaml.Behavior.Uwp" is installed. But that was not the case.

Thanks for any help in advance

Solved: InstallUtil throws ArgumentOutOfRangeException when trying to install windows service.

$
0
0
This is just to help people troubleshoot the ArgumentOutOfRangeException problem when trying to install a windows service with installutil. It took me a good while to understand the reason of the install failure and I could not find anything about this on the web concerning this problem, so hopefully this will help others in the future so they don't waste as much time as I did.

If you get:

An exception occurred during the Install phase.
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length

Then:

1) Go to the deisgner of your ProjectInstaller
2) Select the ServiceProcessInstaller
3) Go to the properties of the ServiceProcessInstaller.
4) If you see Account property set to user, change it to LocalSystem.
5) Rebuild your project.
6) Rerun installutil YourService.exe

Then the exception should be gone and the installation successful.

HTH

Sylvain Boissé Software Architect Noesis Innovation www.noesisinnovation.net

Xamarin

$
0
0
I want to create an android blank app on visual studio, but there is a error always occurs "value can not be null", even when I create cross platform application, just IOS template shows up.

How can I change any type from function signature to object type in IL?

$
0
0
I saw the link below, and want to implement my dynamic IL for making any type to Oject type.
https://blogs.msdn.microsoft.com/davbr/2006/02/27/bug-inspecting-value-type-returns/

My way is below:
1.If a CorElementType is not value type goto end
2.Find the CorElementType's  type string (eg.  ELEMENT_TYPE_BOOLEAN -> L"System.Boolean", ELEMENT_TYPE_I4 -> L"System.Int32"  )
3.Find mdTypeRef from the module token by FindTypeRef with type string.
4.Write IL :  box <mdTypeRef>

Q1: Any problem with my way above?
Q2: How can I judge a CorElementType whether it need box or not  is difficult? 
      I meet an Enumerations argument, and I don't know how to judge his CorElementType and get his mdTypeRef.
Q3: At step2, I need to make a map to change CorElementType to string, then find mdTypeRef by string. 
      It is not elegant, any way more elegant? 
      Can I box all value type with "System.ValueType"'s mdTypeRef directly?

Really appreciate!
Viewing all 1710 articles
Browse latest View live


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