Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all 8156 articles
Browse latest View live

CRAFFT

$
0
0

مركز صيانه كرافت ( 01127571696 ) اصلاح تكييفات كرافت ( 0235695244 )



White whale

windows c# low memory notification

$
0
0

How do I subscribe to Windows Low memory notification from c# ?

our c# app has substantial unmanaged memory allocation, which we can free if OS memory availability is low.


ارقام تليفون اصلاح ثلاجات كريازي & 01014723434 && 0235695244 &الدقهلية

Obfuscation of .NET Standard libraries

$
0
0

Hello friends!

I have a project with .NET Standard class libraries and I need obfuscate it. Previously I've used .NET Reactor for obfuscation but it doesn't work with .NET Standard, it show me such error: "Can't find required Assembly: netstandard". Do you know any tools for obfuscating which work with .NET Standard? 

I am looking forward to your comments.

Thanks in advance!

مراكز صيانة توكيل فريزر ويرلبول _01014723434_01225025360بنها

Obfuscation of .NET Standard libraries

$
0
0

Hello friends!

I have a project with .NET Standard class libraries and I need obfuscate it. Previously I've used .NET Reactor for obfuscation but it doesn't work with .NET Standard, it show me such error: "Can't find required Assembly: netstandard". Do you know any tools for obfuscating which work with .NET Standard? 

I am looking forward to your comments.

Thanks in advance!

Graphics.cs DrawLine freezes

$
0
0

Hello,

I have problem in Graphics class. I use component one report to generate pdf files. Sometimes application freezes. I tried to find place where it freezes and I set up Visual Studio to debug .NET Framework. When application freezed I paused Visual Studio debugger to find area where it freezed. It stopped in Graphics.cs at line 1208 - CheckErrorStatus(status). But I cannot continue to end of method or step into CheckErrorStatus. It looks like there is problem with GDI? 

What can cause this behavior? When it freezed application use CPU as you can see. Application runs on Windows Server 2016 but I can simulate it on Windows 10 Professional (17134.407). Version of .NET Framework is 4.6.1. 


Problem With File Dates Created During Daylight Savings Time

$
0
0

I am using VB .NET 2.0 with Visual Studio 2005.  I have a VB program which keeps adjusting the file dates when the files are considered to have been created or written during a Day Light Savings period.  By this I mean when I read the IsDayLightSavingsTime property of a file date and it returns TRUE. 

For example, if I read a file that was last modified on 5/6/2006 at 8:00 a.m., my VB program keeps adding one hour to the time so it ends up reading as 5/6/2006 9:00 a.m.  How can I stop this?  I need my file dates to match what is shown in the explorer window when you browse your files.  This problem does not happen when the IsDAyLightSavingsTime property reads as FALSE.  Below is a snipet of how I am getting the LastWriteTime of the files:


Dim AllFileInfoForDirFiles As FileInfo()
Dim aDirectoryInfo As DirectoryInfo
Dim aFileInfo As FileInfo
Dim aLastWriteTime As String


AllFileInfoForDirFiles = aDirectoryInfo.GetFiles("*.*")

For Each aFileInfo In AllFileInfoForDirFiles
  aLastWriteTime = (aFileInfo.LastWriteTime).ToString
Next

System.DirectoryServices and Universal Security Groups

$
0
0

I'm trying to use System.DirectoryServices to retrieve the members of a universal security group in AD.  I've implemented it using System.DirectoryServices.AccountManagement and it works.  It's just very slow.  So in my research, I stumbled upon using attribute scoped queries in S.DS to do the same thing, but faster.  My basic code is this:

public IEnumerable<IApplicationUser> GetGroupMembers(string groupName)
{  string domainName = "mydomain.local";  string groupPath = $"LDAP://CN={groupName},OU=Security Groups,OU=USA,DC=mydomain,DC=local";  string filter = "(&(objectClass=user)(objectCategory=person))";  DirectoryEntry group = new DirectoryEntry(groupPath);  DirectorySearcher searcher = new DirectorySearcher();  searcher.SearchRoot = group;  searcher.Filter = filter;  searcher.PropertiesToLoad.Add("samAccountName");  searcher.PropertiesToLoad.Add("name");  searcher.PropertiesToLoad.Add("givenName");  searcher.PropertiesToLoad.Add("middleName");  searcher.PropertiesToLoad.Add("sn");  searcher.PropertiesToLoad.Add("displayName");  searcher.SearchScope = SearchScope.Base;  searcher.AttributeScopeQuery = "member";  using (SearchResultCollection result = searcher.FindAll())  {    return GetApplicationUsersFromResults(result);  }
} 

This code works - so long as all of the users in the group are within the same domain (mydomain).  However, if some of the users in the security group are for another domain in the forest, this code generates the following error:

Unknown error (0x5011)

Of course, the whole reason for using a universal group is so that users from other sibling domains can be added to the group.  Can anyone tell me how to do this search so that the other domain users can be returned without error?  I haven't found anything that works yet other than using S.DS.AccountManagement, but I'd like this to perform well too.


JohnnyG

Can't start/stop SQL Server from VB once Windows 10 installed

$
0
0

I've been using Windows 7 Ultimate, Visual Basic 2013, and SQL Server 2014 SP1. Per this website,

https://technet.microsoft.com/en-us/library/ms162139(v=sql.90).aspx

I've been using the SMO ManagedComputer object to restart (turn off, then turn on) SQL Server from within my VB .Net code. I do this primarily to free up memory after SQL Server does it after some memory-intensive operations (I'm using SQL Server just for myself on my own PCs).

Then, I built a new PC and installed Windows 10 Pro (instead of Windows 7) and VB 2015 (instead of VB 2013), and the exact same VB .Net code that worked before no longer stops and starts SQL Server. So I installed VB 2015 on a PC with Windows 7, and the code worked, so VB 2015 doesn't appear to be the problem. (Incidentally, I tried the code using .Net Framework 4.5.2 and 4.6 on both Windows 10 and 7, and it doesn't change the results, so the framework is not the issue).  Therefore, upgrading to Windows 10 from Windows 7 appears to be causing the code to no longer work. Is this a bug, or do I need to use different code with Windows 10? My guess is that the security is different in Windows 10.

I also tried using the code below to stop/restart SQL Server. It works with Windows 7. With Windows 10, I get the following error when scService.Stop() is executed--this additionally makes me think it is a security issue with Windows 10:

An unhandled exception of type 'System.InvalidOperationException' occurred in System.ServiceProcess.dll

Additional information: Cannot open MSSQLSERVER service on computer 'ASUS5'.

            Dim i, numTries As Integer
            Dim scServices(), scService As ServiceProcess.ServiceController 'need Reference to System.ServiceProcess
            scServices = ServiceProcess.ServiceController.GetServices(My.Computer.Name)
            For i = 0 To scServices.Length - 1
                scService = scServices(i)
                If scService.DisplayName = "SQL Server (MSSQLSERVER)" Then
                    If scService.Status = ServiceProcess.ServiceControllerStatus.Running Then
                        Console.WriteLine("Stopping SQL Server")
                        scService.Stop() : scService.WaitForStatus(ServiceControllerStatus.Stopped) : Thread.Sleep(500)
                    End If
TryStart:           Try
                        numTries += 1
                        scService.Start()
                        Console.WriteLine("Waiting for SQL Server to Start.")
                        scService.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running)
                    Catch ex As Exception
                        If numTries <= 2 Then
                            GoTo TryStart
                        Else
                            MsgBox("Error trying to start SQL Server.  Stopping Program" & vbCr & ex.ToString, MsgBoxStyle.Critical, "Restart SQL Server")
                            Stop
                        End If
                    End Try
                    Exit For
                End If
            Next
How do I start/stop SQL Server within VB .Net code using Windows 10?

install dll from nuget.org

$
0
0

I am trying to install dll for AMO  nuget.org,pls refer the below:

https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers

The website,directs me to nuget gallery,where i search for AMO and  i get the following:

https://www.nuget.org/packages/Microsoft.AnalysisServices.retail.amd64/

I just need Microsoft.AnalysisServer.dll 

How do i install just that from nuget?

I downloaded the package and it gave me subfolders. I went into Lib and found the app extension,but no executable.Looks like i can install them from VS ,but i have to have solution open to do so and it gave me error.I dont understand how the install works from nuget.org and why i should have solution open when i am trying to install the dll into the machine.

It seems lot simpler to install from windows installer instead,but i want to learn doing from nuget

System.Net.HttpWebRequest fails to logon to a website via com-interop in Windows 10 1809

$
0
0

This problem is described in more detail here on stack overflow, below is a summary.  The question is, how can I solve this, or is this a bug in Windows and/or the .Net framework?

I have a small piece of C# code which logs in to a website, and

  • Works when called on computer A from Excel 2010 VBA via com-interop
  • Works when called on computer B from a C# console application, but
  • Fails when called on computer B from Excel 2010 VBA via com-interop

The main difference between computer A and computer B is that computer A has windows 10 version 1803, whereas computer B has windows 10 version 1809. Both computers have Studio 2017, and in all cases the target .Net Framework is 4.6.2.  In all cases, a little JSON object is returned, where the JSON object has a field called "loginStatus". When it works, "loginStatus"="SUCCESS", but when it fails "loginStatus"="CERT_AUTH_REQUIRED".

I looked at the settings in System.Net.ServicePointManager and they're identical in all cases.  I tried using the .Net Framework 4.7.1 instead of 4.6.2 but the results were the same.  I used Fiddler to review the structure of the https calls that are being made to the website. The two that work look identical, and the one that fails looks slightly different:

Calls that work OK

  • TLS extension ec_point_formats = uncompressed [0x0]
  • TLS extension encrypt_then_mac (RFC7366) not specified
  • TLS extension renegotiation_info = 0
  • Cipher TLS_EMPTY_RENEGOTIATION_INFO_SCSV not specified

Failed call

  • TLS extension ec_point_formats = uncompressed [0x0], ansiX962_compressed_prime [0x1], ansiX962_compressed_char2 [0x2]
  • TLS extension encrypt_then_mac (RFC7366) = empty
  • TLS extension renegotiation_info not specified
  • Cipher TLS_EMPTY_RENEGOTIATION_INFO_SCSV specified

I have no idea how to solve this, please help.

.net core as service calling web api

$
0
0

I have a .net core service listening for http requests. I want it to to call a web api using a windows credential. I have specified in the http client to use NTLM and passed in a network credentital 

              

 services.AddHttpClient("webApi").ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler
            {
                Credentials = new CredentialCache {
                    {
                        new Uri("http://localhost:61268/api/messages"), "NTLM", new NetworkCredential("xxx", "yyyy", "zzzz")

                    }
                }
            });

     in a service where I have injected the IHttpClientFactory  

      var client = _clientFactory.CreateClient("webApi");
      var httpResponse = client.PostAsync(uri, httpContent);

This yields a 401. The webapi is running on my local machine in IISExpress and has anonymous turned off and it has Windows Authentication turned on. 

Is it possible to call the web api using an account other than the one under which the service is running?


How to combine string Date and string time into DateTime

$
0
0

I’ m getting Date and Time as separate  string

Date: “12/22/2012”

Time: “10:00 AM”

How do I combine this together into one C# DateTime field


Registry.LocalMachine with OpenSubKey yields 'System.Security.SecurityException'

$
0
0

I am trying to run the following:

RegistryKey rk = Registry.LocalMachine;
RegistryKey softwareKey = rk.OpenSubKey("Software",
                                           RegistryKeyPermissionCheck.ReadWriteSubTree);

in the debugger.  My account has administrative privileges, but I get exception 'System.Security.SecurityException' on the second line of code.

Is there no way to run this code in the debugger?  Or am I doing something stupid?

I am running Windows 7 Pro, Visual Studio 2010.

Thanks in advance,
Michael Bate

Blue Prism Error - System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

$
0
0

hello Folks,

I am new to Blue Prism.

I have an internal portal wherein i am trying to access a value from a dropdown using Blue Prism automation. I have tried spying the dropdown using various methods (IE HTML, Win 32, UI Automation, Accessibility Mode). I am able to select the dropdown and i see all the values. but i am not able to select any value from dropdown. I am trying to pass the value through Global Send keys but its not working and giving me below error.

Internal : Failed to perform step 1 in Navigate Stage 'Navigate1' on page 'Action 1' - Exception during remote setforegroundwindow - System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at BluePrism.ApplicationManager.Operations.WindowOperationsProvider.ForceForeground(IntPtr windowHandle)

Header content moved to the previous page while compare with DOC and DOCX format documents.

$
0
0

Hi, While viewing this attached“HeadingsShiftingUpwards.doc” document, “Notification History” text present in 5<sup>th</sup> page. Same text moved to the 4<sup>th</sup> page after resave the same document as DOCX format(HeadingsShiftingUpwards_MS.docx) by using Microsoft Word application as like attached screenshot.

I have attached Word documents and screenshot for your references.
 
Can anyone help on this, what is exact behavior difference exist in these documents (DOC and DOCX formats). Is there any known limitation?


Thanks,
Sivasubramani.

Sometimes cannot get a System.DirectoryServices.Protocols.SearchResponse

$
0
0
I am using the System.DirectoryServices.Protocols library to connect to an LDAP source. I have not had any issues with eDirectory, but I am having some trouble with Active Directory.

The Active Directory server is running on a Windows 2003 machine.

Here's a summary of the code I've been using (try catches were removed):
LdapConnection con = new LdapConnection(new LdapDirectoryIdentifier(Server, Port));
con.SessionOptions.SecureSocketLayer = false;
con.Credential = new NetworkCredential(Username, Password);
con.AuthType = AuthType.Basic;
con.Bind();
SearchRequest request = new SearchRequest(DN,FILTER,System.DirectoryServices.Protocols.SearchScope.Subtree);
SearchResponse response = (SearchResponse)con.SendRequest(request); //this is the line that throws a DirectoryOperationException

Here's the stack trace from the exception:
System.DirectoryServices.Protocols.DirectoryOperationException was caught
  Message="An operation error occurred."
  Source="System.DirectoryServices.Protocols"
  StackTrace:
       at System.DirectoryServices.Protocols.LdapConnection.ConstructResponse(Int32 messageId, LdapOperation operation, ResultAll resultType, TimeSpan requestTimeOut, Boolean exceptionOnTimeOut)
       at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
       at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request)
       at <the line that I call from>

Here's the message that was stored in the response of the DirectoryOperationException:
"00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece"
I think this error message is a little fishy because when I debug line by line, it successfully passes the con.Bind() line.

Now it continues like this for an hour or so. Afterwards, I am able to authenticate succesfully every time. In summary, it works sometimes. I thought the server might have gone down. However, I can login and browse succesfully using a third party LDAP client. This gives me strong reason to believe that it's not the servers issue, but an issue with my code.

If I am missing any information I will try my best to get it for you as quickly as possible. Thank you in advanced for your help!

Keep it dry, shy and tell the other guy.

How to get a timestamp with microsecond value.

$
0
0

In my C# project, while a UDP packet arriving, I need to log a timestamp with microsecond value.

Below is a sample function to use microsecond timestamp:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace datetimetest
{
    class Program
    {
        static void Main(string[] args)
        {
            for(int i=0;i<10;i++)
            {
                long currentTick = DateTime.Now.Ticks;
                Console.WriteLine("currentTick:{0};  timestamp:{1}", currentTick, new DateTime(currentTick).ToString("HH:mm:ss.ffffff"));
            }
            Console.ReadLine();
        }
    }
}

I got below result:

currentTick:636844467783194613;timestamp:12:06:18.319461
currentTick:636844467783204613;timestamp:12:06:18.320461
currentTick:636844467783214613;timestamp:12:06:18.321461
currentTick:636844467783214613;timestamp:12:06:18.321461
currentTick:636844467783214613;timestamp:12:06:18.321461
currentTick:636844467783214613;timestamp:12:06:18.321461
currentTick:636844467783214613;timestamp:12:06:18.321461
currentTick:636844467783214613;timestamp:12:06:18.321461
currentTick:636844467783214613;timestamp:12:06:18.321461
currentTick:636844467783214613;timestamp:12:06:18.321461

My questions are:

1. On some PCs, the last 4 numbers would never change. In above case, the last 4 numbers are always "4613". Why?

2. Is there any better way to get the timestamp with microsecond value?

Any comments are highly appreciated. 


Viewing all 8156 articles
Browse latest View live


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