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

clr.dll error cause stop my service

$
0
0

I made a windows service project named "WindowsService-DS".

Then I run it on more than one computer. Then some of them will stop my service with an error, the error modle is "clr.dll" and error code is "c0000005".

It is strange that only three computer have the error. And I can only find "ntdll.dll" error from the system dump file. I have tryied to  restore donet library,but it is not work. "clr.dll" file version is 4.0.30319.17929

It have occured 5 times on three computer, and i have no idea. 

Look forward to your reply


Unable to install Support for TLS System Default Versions included in the .NET Framework 3.5 on Windows 8.1 and Windows Server 2012 R2

$
0
0

When i am trying to install i am getting error.

[Window Title]
Windows Update Standalone Installer

[Main Instruction]
Windows Update Standalone Installer

[Content]
The update is not applicable to your computer.


[OK]

clr.dll error cause stop my service

$
0
0

I made a windows service project named "WindowsService-DS".

Then I run it on more than one computer. Then some of them will stop my service with an error, the error modle is "clr.dll" and error code is "c0000005".

It is strange that only three computer have the error. And I can only find "ntdll.dll" error from the system dump file. I have tryied to  restore donet library,but it is not work. "clr.dll" file version is 4.0.30319.17929

It have occured 5 times on three computer, and i have no idea. 

Look forward to your reply

.Net framework 4.8 installation(on server 2012) or windows server 2019 upgrade which is better?

$
0
0

Hi All,

Should I install 4.8 framework on a production server(windows 2012) or suggest to upgrade windows to 2019 server edition?

Please suggest with a brief explanation.

Thanks,

Subhankar

How to avoid Object Reference to null?

$
0
0

Hi,

I am using this if condition to search the data:

if (services.first_name.ToLower().Contains(searchBar.Text.ToLower()) || services.middle_name.ToLower().Contains(searchBar.Text.ToLower()) || services.last_name.ToLower().Contains(searchBar.Text.ToLower()) || services.email_address.ToString().Contains(searchBar.Text.ToLower()))

My data is like this:

public class UsersData
{
    public int user_id { get; set; }
    public string first_name { get; set; }
    public string middle_name { get; set; }
    public string last_name { get; set; }
    public string email_address { get; set; }

    public string full_name
    {
        get
        {
            string user_full_name;

            user_full_name = first_name;
            user_full_name += " " + middle_name;
            user_full_name += " " + last_name;

            return user_full_name;
        }
    }

    public string user_image
    {
        get
        {
            return string.Format("https://www.ajworld.app/gallery/photos/{0}.png", user_id);
        }
    }
}


but some values might be null in MySQL which cause a crash in my code, e.g. middle_name

How can i solve this please?

Thanks,

Jassim

Access a network drive (ip/folder) programmatically to create folder, write files and copy files

$
0
0

Hi All,

We have windows form application using C# , which has to do the below functionality to network drive 

1,  create new folder,

2 delete, create new file 

3 , copy file from shared drive to local folder


The shared drive is exactly like \\192.XX.XX.X2\Repository\Repo1

Currently we have users connecting out office network via Vpn

and some user connect directly to network from office.


Can you please help me how to programmatically connect inside the application with out any prompt window to copy files and create folders  from local pc to the shared drive path mentioned above.

Requirement is copy file of size ranging from 1 MB up-to 20MB

Thanks,

Have a nice day ahead.


I need some unity help

$
0
0

so this is my code for the enemy movement:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using UnityEngine;

public class Enemy_Movement : MonoBehaviour
{

    public float moveSpeed = 5f;
    public int randomNumber;
    Vector2 movement;
    public GameObject prefab;


    private void PickNumber(int maxInt)
    {
        int randomNumber = Random.Range(0, maxInt + 1);
    }
    // Update is called once per frame
    void Update()
    {
        if (randomNumber.x == 0) ;
        {
            movement.x = 1;
            System.Threading.Thread.Sleep(2000);
            movement.x = -1;
            System.Threading.Thread.Sleep(4000);
            movement.x = 1;
            System.Threading.Thread.Sleep(2000);
            movement.x = 0;
            PickNumber(2);

        }
        if (randomNumber == 1) ;
        {
            movement.x = 1;
            movement.y = -1;
            System.Threading.Thread.Sleep(1000);
            movement.x = 1;
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.x = -1;
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.x = -1;
            movement.y = -1;
            System.Threading.Thread.Sleep(2000);
            movement.x = -1;
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.x = 1;
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.x = 1;
            movement.y = -1;
            System.Threading.Thread.Sleep(1000);
            movement.x = 0;
            movement.y = 0;
            PickNumber(2);

        }
        if (randomNumber == 2) ;
        {
            movement.x = 1;
            System.Threading.Thread.Sleep(2000);
            movement.x = -1;
            System.Threading.Thread.Sleep(4000);
            movement.x = 1;
            System.Threading.Thread.Sleep(2000);
            movement.x = 0;

        }
        if (randomNumber == 2) ;
        {
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.y = -1;
            System.Threading.Thread.Sleep(1000);
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.y = -1;
            System.Threading.Thread.Sleep(1000);
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.y = -1;
            System.Threading.Thread.Sleep(1000);
            movement.y = 1;
            System.Threading.Thread.Sleep(1000);
            movement.y = -1;
            System.Threading.Thread.Sleep(1000);
            movement.y = 0;
            PickNumber(2);
        }

        void FixedUpdate()
        {
            rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
        }
    }
}

however the unity console returns

Assets\Enemy_Movement.cs(18,28): error CS0104: 'Random' is an ambiguous reference between 'UnityEngine.Random' and 'System.Random'

I have absolutely no idea how to fix this. Please help. 

.Net framework 4.8 installation(on server 2012) or windows server 2019 upgrade which is better?

$
0
0

Hi All,

Should I install 4.8 framework on a production server(windows 2012) or suggest to upgrade windows to 2019 server edition?

Please suggest with a brief explanation.

Thanks,

Subhankar


A possible bug with redirecting RedirectStandardInput to console application from windows form (Win7x64)

$
0
0

More info can be found on this post:

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/23527505-236f-4bba-99ae-f8bece281d44

 

Basically when I attempt to redirect the standard input of a console application from windows form the console application crashes immediately.

 

When I use the exact same code from a console application everything works fine (this is what leads me to believe it might be a bug).

 

Here's the shortest code you need to reproduce the problem:

 

Process myProcess = new
 Process();
myProcess.StartInfo.FileName = @"cmd.exe"
;
myProcess.StartInfo.UseShellExecute = false
;
myProcess.StartInfo.RedirectStandardInput = true
;
myProcess.Start();

 

Please note the following:

1. When I change "cmd.exe" to "sort.exe" it works find on both console and windows form applications.

2. When compiling to windows application for 64 bit platform (or AnyCPU) the "myProcess.MainModule" throws an exception: {"Only part of a ReadProcessMemory or

WriteProcessMemory request was completed"}

3. When compiling to windows application for 32 bit platform the "myProcess.MainModule" throws an exception: {"A 32 bit processes cannot access modules of a 64 bit process."}

 

I scanned the net for the past 3 days and I was able to find only a few posts regarding this issue in multiple sites.

The posts I found didn't provide a solution and used the programming languages c# and vb.net.

 

That basically leads me to think the problem is in .NET itself.

 

I'm using Windows 7 x64 Ultimate and Visual Studio 2010 Ultimate with .NET 4.

 

Do you guys have any suggestions as to how I can start a process with "cmd.exe" (or a windows batch file) and redirect the standard input to it from a windows form application?

 

Thanks in advance,

daat99

 


I always try to help ;) sometimes I don't know how :( <script type="text/javascript"></script> <script type="text/javascript"></script>

Ml.Net Invalid GraphDef

$
0
0

Hi,

We are working on how to consume the tensorflow model in .Net using ML.NET. We are using below tutorial as reference :

Tutorial Link : https://docs.microsoft.com/en-us/dotnet/machine-learning/tutorials/image-classification

We tested with model that is used in the Tutorial and it worked fine. But, when we replace tutorial model with our tensorflow model (object detection model which we have exported from Azure Custom Vision), it is throwing an Exception saying‘Invalid GraphDef’, while loading the tensor flow model. The same custom vison model works fine when consumed in Python code.

We checked multiple forums but could not find right resolution.

Details:

Project Name : TransferLearningTF

Class name : program.cs

Method Name : GenerateModel

Code :

IEstimator<ITransformer> pipeline = mlContext.Transforms.LoadImages(outputColumnName: "input", imageFolder: _imagesFolder, inputColumnName: nameof(ImageData.ImagePath))

                                                                                             .Append(mlContext.Model.LoadTensorFlowModel(_inceptionTensorFlowModel)

                                                                                                                .ScoreTensorFlowModel(outputColumnNames: new[] { "softmax2_pre_activation" }, inputColumnNames: new[] { "input" }, addBatchDimensionInput: true))

Exception Details :

ExceptionMessage : Tensorflow exception triggered while loading model

Source : Microsoft.ML.TensorFlow

Stacktrace

   at Microsoft.ML.TensorFlow.TensorFlowUtils.LoadTFSessionByModelFilePath(IExceptionContext ectx, String modelFile, Boolean metaGraph)    at Microsoft.ML.TensorFlow.TensorFlowUtils.GetSession(IHostEnvironment env, String modelPath, Boolean metaGraph)    at Microsoft.ML.TensorFlow.TensorFlowUtils.LoadTensorFlowModel(IHostEnvironment env, String modelPath)    at Microsoft.ML.TensorflowCatalog.LoadTensorFlowModel(ModelOperationsCatalog catalog, String modelLocation)    at PredictionModel.Program.GenerateModel(MLContext mlContext) in D:\Cognitive-Samples-VideoFrameAnalysis-master\Windows\PredictionModel\Program.cs:line 35    at PredictionModel.Program.Main(String[] args) in D:\Cognitive-Samples-VideoFrameAnalysis-master\Windows\PredictionModel\Program.cs:line 22

Inner Exception:

Exception  Message : Invalid GraphDef

Source :  TensorFlow.NET

Stacktrace

   at Tensorflow.Status.Check(Boolean throwException)    at Tensorflow.Graph.Import(Byte[] bytes, String prefix)    at Tensorflow.Graph.Import(String file_path, String prefix)    at Microsoft.ML.TensorFlow.TensorFlowUtils.LoadTFSessionByModelFilePath(IExceptionContext ectx, String modelFile, Boolean metaGraph)

app.config versus application settings

$
0
0

I just started using app.config to set certain settings for the application. I would like to give the user the ability to adjust.

I'm able to read app.confgi without any issue but I'm finding it difficult to write new vales back. I then discovered application settings. Since I'm new .Net  I would like to know what is the best option for my needs.

I'm storing approx. five string settings and I have no need to create new ones during runtime. I would like to give the user the ability to edit and save the settings for the next time the program is run.

Debugging a DLL from my own Visual Studio Extension

$
0
0

I have created a TCP Server which has a method. When the method is invoked, it loads a DLL (Class Library) and access its method and return its result.

I have developed a custom Visual Studio Extension. I have installed my own Extension in Visual Studio so that when I start Visual Studio, it appears as a window in Visual Studio similar to Solution Explorer, Properties windows. 

And in that Extension Window, on click of a button "load", the logic is written in such a way that, it sends a request to a TCP Server and display its response in the Extension Window.

With this setup, here is the below steps I followed:

  1. Open Visual Studio
  2. Load a DLL Project (DLL_Project_1)
  3. Start the TCP Server
  4. Open the Extension Window and click on "load" button

Background operation: On click of "load" button, a request is sent to the TCP Server. The TCP Server loads the DLL (DLL_Project_1.dll, which is the project I loaded in the Visual Studio), access its method and returns the result. The result is successfully displayed on the Extension Window.

Now I would like to debug the DLL_Project_1 dll's method (which was accessed by TCP Server) in Visual studio

  1. Open Debug -> Attach to Process
  2. Select the "TCP Server"  process and click "Attach"
  3. Open the DLL method .cs file and keep the break point in the method.
  4. Open the Extension Window and click on "load" button

The Visual Studio application got stuck and it did not hit the breakpoint. 

Note: If there is no breakpoint, the result is displayed in the Extension Window.

So, in summary, I would like to debug the dll's method in the visual studio itself, when the TCP Server executes the dll method. But it is not working as expected.

Any help on this would be really helpful. Thanks in advance.


Get IP address, sub net mask and gateway of network adapter

$
0
0

I want to know how to get IP address, subnet mask and gateway currently applied on network adapter in my PC by vb .net.

Do not use ManagementObject because it only work for active adapter. And do not use registry and command line.

Thanks

Copy rows from excel sheet and paste into DataGridView

$
0
0

How to implement this:

In excel sheet, select some rows and copy them. Then at my DataGridView control in my application, press Ctrl-V, all copied rows in excel are added to my DataGridView.

Thanks.

Pass information from one form to another

$
0
0

I have a simple form that is loaded from the main function in Module1. The user can launch another form that allows the user the ability to make changes to custom settings.

When the user closes the settings form I would like to pass information to update the main form. Currently, the user must exit the program and re launch it to read the updated settings.


how to compare the structure of two DataTables in C#

$
0
0
Hi Friends,

We are doing oracle bulk upload functionality.

Our application will let the user to generate the excel template.

We will  do "select * from table where 1>1" with that metadata we will create the excelfile. 

User will use the excel file and fill the data and upload the file.

In our application we will read the uploaded excel file and create DataTable.

Now here I want to compare DataTable created from the user uploaded excel data with the DataTable created using "select * from table where 1>1"

Here we want to compare

1)These two DataTables has same number of columns
2)These two DataTables has same number of columns and it has same name?
3)These two DataTables has same number of columns and it has same name and it has same datatype?

I can do oracle bulkupload if the above 3 validations are success

How can i do the above. Please help

Using AuthenticationHandler for implementing my own Authentication logic.

$
0
0

Hi *

   I am planning to implement my own Authentication/ Authorization logic in my application. I understand I need to write my own handler to implement the logic.  I see that the AuthenticationHandler<TOptions> class comes under two namespaces. 

    Microsoft.AspNetCore.Authentication

    Microsoft.Owin.Security.Infrastructure

   could anyone please explain when to use those class i.e, what factors decide which namespace I need to use.  

Thanks,

sanjay.

how to change the structure of a datatable baesd on another datatable in C#

$
0
0

Hi Friends,

We have excel upload and download functionality.

Lets say in a database we have oracle table lets call it as "tblProduct" and it has some 25 columns of different datatypes.

When the user clicks on download we will just get metadata of the table and create a excel file and user will get the excel file.

User will fill the excel file and upload the file. In the C# code we will read the excel and put those values in  Datatable lets say "tblExcel".

And in this "tblExcel" all the column will be of type string only.

so we want to change the datatype of columns in the "tblExcel" to datatype of columns in the "tblProduct" so that the structure will match.

How to convert the "tblExcel" columns types based on "tblProduct"

Getting a 403 on a file my browser can read

How to Open a standard ContextMenue of a Control (TextBox) in Windows Forms

$
0
0

Hi all,

I would like to open the normal ContextMenu (see below) of a TextBox (the menu that opens when one pressed the right mouse button) programmatically. I tried hard with OnMouseUp and the like but in vain.

I believe that the Forms experts have done this many times 😊.


Regards Jörg

Viewing all 8156 articles
Browse latest View live


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