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

migration of .net framework Visual studio 2019 based project to .net core 3.0

$
0
0

Hi Team,

I am doing migration of .net framework Visual studio 2019 based project  to .net core 3.0 and observed a breakdown of many API we are using and the same isn't available in target .NET Core platform.

Kindly suggest do i need to rewrite API .

Regards,
Rakesh Singh



DllImport in .NetCore

$
0
0

Hi,

I have to port .netFramework code which has dllimport("kernel32.dll") to .NetCore(targeting ubuntu 14 and windows). Question is when we have dependency on such dlls (native to windows /any platform) how the ported code will work on other platforms? 

Such dll dependencies need to be replaced by ubuntu specific in my case? then portability will break. 

Any ideas how to address this, thanks in advance.

JIT

The process cannot access the file because it is being used by another process.

$
0
0

Hi all,

I am trying to create a file from binary and then show it in webbrowser, after closening program, I want to delete folder and all files inside. Everything goes well  but after exit app it stop in this exit functionm when I am trying to delete folder and shows me an error:

The process cannot access the file, because it is being used by another process.

I have this problem only with pdf files. I had same with images, but I fixed it by adding OnLoad on bitmap, likes this ...

BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.CacheOption = BitmapCacheOption.OnLoad;
bi.UriSource = new Uri(cela_cesta);
bi.EndInit();

BUT i have no idea what to do with pdf files ... it seems that problem is here

pdfDocument.Navigate(new Uri(full_path_file));

pdfDocument is name of WebBrowser in *.xaml

... and exit app (just for info - I dont thing here is a problem)

if (Directory.Exists("temp"))
{
    Directory.Delete("temp", true);
}

kerberos and ntlm connection

$
0
0

Hi,
I've a web application (my first) which connect to SQL,
all the sql connections should connect using Kerberos
but 1 part of the application should made a sql connection with the application pool identity (domain accaount)
My connectionstring :
<add name="MyConnectionString" connectionString="Data Source=xxxxxx;Initial Catalog=xxxxxx;Integrated Security=True" providerName="System.Data.SqlClient" />
Kerberos works fine, but how do i define a connectionstring that will not use kerberos, without setting password in webconfig
tried already uid=domain\user

thanks

How to get changed Computer Name without restarting the computer

$
0
0
Hi,
 
I changed a computer from "A" to "B" . I don't restart the computer. When I use System.Environment.MachineName I get "A" and not "B" - which correct. But when I see " System Property page" , " Computer Name tab " I see computer name as "B".

Where does "B" get saved in Windows memory and how do I access that value.

Please can somebody help me on this.

Fake dll in .net core

$
0
0

Hi Team,

I am doing a migration asp.net project 4.5 frameworks toasp.net core 3.1.

I can see fake dll is used in 4.5 framework so this is feature of Visual studio enterprise edition inasp.net core also we can generate fake dll

so want to know is fake dll is supported in .net core?

any suggestion and help will be highly appreciated on how to proceed further on this.
Regards

How to get changed Computer Name without restarting the computer

$
0
0
Hi,
 
I changed a computer from "A" to "B" . I don't restart the computer. When I use System.Environment.MachineName I get "A" and not "B" - which correct. But when I see " System Property page" , " Computer Name tab " I see computer name as "B".

Where does "B" get saved in Windows memory and how do I access that value.

Please can somebody help me on this.

RegFree use of .Net Core 3.1 class library from VB6 exe app

$
0
0

Made a simple .net core 3.1 RegFree.dll and added both EnableComHosting and EnableRegFreeCom (both values=true).
Build the project and manifest is also built (RegFree.X.manifest)

Then I make a simple VB6 app (VB6Client.exe) trying to use the component.
First I try registration by regsvr32 RegFree.dll.
Then I try to add a reference from VB6 IDE "Project/References, but it cannot be found in "Available References:" list in the references dialog, which is perhaps logical when a tlb is missing(?), adding the RegFree.dll or RegFree.comhost.dll fails: "Can't add a reference to the specified file.".
Giving up this, I try to do it late bound with:

Dim RegFreeObject As Object
Set RegFreeObject = CreateObject("RegFree.Server") 'Server is a class name

And it works ok, but, of course with the lack of "intellisense" due to late binding, which is something I can live with.

Then I unregsister the dll again and of course it fails as expected (429), but how to do this regfree?
I tried to add a manifest describing the exe app as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="VB6Client.exe" version="1.0.0.0" type="win32" processorArchitecture="x86"/>
<description>Built with: Side-by-Side Manifest Maker (3.7.1.4434) (x86)</description>
<dependency>
<dependentAssembly>
  <assemblyIdentity name="RegFree.X" version="1.0.0.0" type="win32"/>
</dependentAssembly>
</dependency>
</assembly>

But anyway I get 429.
I have no clue if the handmade VB6Client.manifest is correct (the RegFree.X.manifest is made by VS 2019 and I assume that's perfect).
Further I have no clue if early binding of regfree COM is supposed to be possible.
I don't even know if this is a possible scenario at all.

Anyone?

Need to get the phonemic spelling of a word in Russian language

$
0
0
In my .NET application, I have a string containing text in Russian language. I need to get not an audio file, but text string containing phonemic spelling symbols. Maybe there are helper classes in standard .NET library? Help, please.

If you can't fix it, feature it!

Unable to read certain mp4 file attributes using Windows Media SDK Media.GetItemInfo Method

$
0
0
I am using the WMPLib to obtain various attribute on H.264 encoded mp4 files. I encode them either with Intel GPU or use a CPU software encoder. In either case, somewhat randomly, some files that were encoded will not return valid attributes using the Windows Media Player's WMPLIB method getIteminfo ( ). It returns null values on attributes such as FrameRate, or zero values on Duration, Width, Height, etc. Yet, I can play these files with the Window Media Player application, and using Mediaarea's MediaInfo, all attributes seem to be in place. I've seen this happen in both Windows 7 and Windows 10.  Interestingly,I discovered, if I make a copy of the 'bad' mp4 file using Windows Explorer, the copy will then return valid attributes for framerate, Duration, etc.  This works for all the files that originally produced invalid values. How can I diagnose this? 

Encryption and Decryption BLOB File

$
0
0

Hi

I need your advice of how to encrypt and decrypt blob file (50MB) in vb.net

SystemEvents not working from a Windows Service

$
0
0

Requirements: Windows 10 1909 Build 18363, Visual Studio 2019 Version 16.6.1

The MSFT documentation on SystemEvents gives a clear example of how to hook SystemEvents into a Windows Service, by creating a hidden Form.  However, following the instructions exactly, I am not able to get any of the SystemEvents to log a message to the Event Viewer.  Does this no longer work?  I am running Windows 10 1909 (Build 18363), using Visual Studio 19 Version 16.6.1.

Program.cs:

using System.ServiceProcess;

namespace WindowsServiceWithGuiTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new Service1()
            };
            ServiceBase.Run(ServicesToRun);
        }
    }
}

ProjectInstaller.cs:

using System.ComponentModel;

namespace WindowsServiceWithGuiTest
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : System.Configuration.Install.Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }
    }
}

ProjectInstaller.Designer.cs 'InitializeComponent' method:

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
            // 
            // serviceProcessInstaller1
            // 
            this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
            this.serviceProcessInstaller1.Password = null;
            this.serviceProcessInstaller1.Username = null;
            // 
            // serviceInstaller1
            // 
            this.serviceInstaller1.Description = "This is a test service that also launches a GUI which you can hook system events " +"into.";
            this.serviceInstaller1.DisplayName = "ServiceWithGuiTest";
            this.serviceInstaller1.ServiceName = "ServiceWithGuiTest";
            this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
            // 
            // ProjectInstaller
            // 
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
            this.serviceProcessInstaller1,
            this.serviceInstaller1});

        }

Service1.cs:

using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading;
using System.Windows.Forms;

namespace WindowsServiceWithGuiTest
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            EventLog.WriteEntry("WindowsServiceWithGuiTest", "Starting Service");
            new Thread(RunMessagePump).Start();
        }

        void RunMessagePump()
        {
            EventLog.WriteEntry("WindowsServiceWithGuiTest.MessagePump", "Starting Message Pump");
            Application.Run(new HiddenForm());
        }

        protected override void OnStop()
        {
            Application.Exit();
        }

        public partial class HiddenForm : Form
        {
            public HiddenForm()
            {
                InitializeComponent();
                EventLog.WriteEntry("WindowsServiceWithGuiTest.HiddenForm_FormClosing", "Form c'tor finished");
            }

            private void HiddenForm_Load(object sender, EventArgs e)
            {
                EventLog.WriteEntry("WindowsServiceWithGuiTest.DisplaySettingsChanged", "Form loaded");
                SystemEvents.TimeChanged += new EventHandler(SystemEvents_TimeChanged);
                SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UPCChanged);
                SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
            }

            private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
            {
                EventLog.WriteEntry("WindowsServiceWithGuiTest.DisplaySettingsChanged", "Display Settings Have changed");
            }

            private void HiddenForm_FormClosing(object sender, FormClosingEventArgs e)
            {
                EventLog.WriteEntry("WindowsServiceWithGuiTest.HiddenForm_FormClosing", "Form closing");
                SystemEvents.TimeChanged -= new EventHandler(SystemEvents_TimeChanged);
                SystemEvents.UserPreferenceChanged -= new UserPreferenceChangedEventHandler(SystemEvents_UPCChanged);
                SystemEvents.DisplaySettingsChanged -= SystemEvents_DisplaySettingsChanged;
            }

            private void SystemEvents_TimeChanged(object sender, EventArgs e)
            {
                EventLog.WriteEntry("WindowsServiceWithGuiTest.TimeChanged", "Time changed; it is now " +
                    DateTime.Now.ToLongTimeString());
            }

            private void SystemEvents_UPCChanged(object sender, UserPreferenceChangedEventArgs e)
            {
                EventLog.WriteEntry("WindowsServiceWithGuiTest.UserPreferenceChanged", e.Category.ToString());
            }
        }

        partial class HiddenForm
        {
            private System.ComponentModel.IContainer components = null;

            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }

            private void InitializeComponent()
            {
                this.SuspendLayout();
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(0, 0);
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.Name = "HiddenForm";
                this.Text = "HiddenForm";
                this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
                this.Load += new System.EventHandler(this.HiddenForm_Load);
                this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HiddenForm_FormClosing);
                this.ResumeLayout(false);
            }
        }
    }
}

When I compile, install, and start the service, then try to do something like change the time, change my desktop background, or change my display resolution, NOTHING HAPPENS!  The last seen event log message is that the "Form loaded".

Any help would be greatly appreciated!

Tam

Summary List of All .NET Framework Classes?

$
0
0
Is there a single document containing a list and brief summary of all 4000 (approx) classes in the .NET Framework and/or .NET Core?  As I start to work on a project I want to be sure that I'm not creating a class to do a job that is already available in the framework.  As I study the .NET documents, they seem to be never ending.  For example, I might start by studying the System namespace, which leads to the System.Collections namespace or the System.Data namespace, etc. etc.  I understand these separate documents are needed to provide details of the implementations along with examples, but it would be nice to have a single place to look that just provides the list of classes and brief descriptions of them.

WPF, XAML, Combobox: Cannot find source for binding with reference

$
0
0

I have some comboboxes that use the same possible input values. Hence I tried to create a style and then set the style on my combo boxes. However, I am getting the error

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')

My style is defined as

<Window.Resources><Style TargetType="{x:Type ComboBox}" x:Key="MyCombobox" xmlns:c="clr-namespace:System.Collections;assembly=mscorlib"><Setter Property="ItemsSource"><Setter.Value><c:ArrayList><ComboBoxItem>Item1</ComboBoxItem><ComboBoxItem>Item2</ComboBoxItem><ComboBoxItem>Item3</ComboBoxItem></c:ArrayList></Setter.Value></Setter></Style></Window.Resources>

Then my comboboxes are defined as

<ComboBox x:Name="comboBox1" Text="{Binding Path=Input1}" Style="{StaticResource MyCombobox}" /><ComboBox x:Name="comboBox2" Text="{Binding Path=Input2}" Style="{StaticResource MyCombobox}" />

Input1 and Input2 are text properties in my VM. So why am I getting this error?


compilation error in converting .net framework to .net standard dll

$
0
0
We converted class library from .net framework to .net standard 2.0
Project A conosle app in .net framework 4.6.2 starts complaining. which uses the above library.

SeverityCode DescriptionProjectFileLineSuppression State
ErrorCS0433 The type 'XmlElementAttribute' exists in both 'System.Xml.XmlSerializer, Version=4.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
SeverityCode DescriptionProjectFileLineSuppression State
ErrorCS0433 The type 'ConcurrentDictionary<TKey, TValue>' exists in both 'System.Collections.Concurrent, Version=4.0.13.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
SeverityCode DescriptionProjectFileLineSuppression State
ErrorCS0433 The type 'ConfigurationManager' exists in both 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'


I tried adding nuget of Microsoft.Windows.Compatibility to console app but it doesn't help.
console app had reference to both System.Configuration.dll and system.configuration.configurationManager nuget.

Moving Accounts

$
0
0
I asked a question on this forum but was told to instead ask the question on this forum https://docs.microsoft.com/en-us/answers/index.html I couldn't log in with the username and pwd from this forum but had to create a new log in. So is the previous link some competing forum and somebody wants me to switch to that forum? That also means I have to restart all my credentials. Not that I had many but I certainly would prefer not to start back at 0. Also, I would like to manage all my previous posts from one account and not two accounts. 

TLS 1.3 support

$
0
0

Hi Team,

I have migrated project from .net 4.5 to 4.8 framework could you please let us know is  TLS1.3 support available?

Do i need to do code changes for this i think framework should default support

any suggestion and help will be highly appreciated on how to proceed further on this.

TLS 1.3 support testing

$
0
0

Hi Team,

I have migrated project from .net 4.5 to 4.8 framework could you please let us know is  TLS1.3 support available?

How to enable TLS1.3 in window os.

any suggestion and help will be highly appreciated on how to proceed further on this.

TLS 1.3 support

$
0
0

Hi Team,


I have migrated project from .net 4.5 to 4.8 framework could you please let us know is  TLS1.3 support available?

As i found mostly comments not supported so could you please let us know test cases to validate the same

i tried to captured logs when response and request happened but  i am getting default TLS 1.2 logs only ..

any suggestion and help will be highly appreciated on how to proceed further on this.

Viewing all 8156 articles
Browse latest View live