CPU increasing up to 99% when runing .Net in vscode - c#

I tried to make a C# project in vscode. At first, it's all fine when I created the project with dotnet new console -o MyApp -f net7.0. But when i tried to run it with dotnet run, my entire screen was freezes and when I check it with task manager, the memory and CPU are increasing maximumly and I have to force restart my computer. This is the details software and hardware that i used:
Operating system: Windows 7 Ultimate x64
Processor: 1.80Ghz Intel Celeron 1000M
Memory: 8GB 800Mhz DDR3
Vscode version: 1.70.3 (last version for Windows 7)
Project Framework: .Net SDK 7.0.102
I tried to find the solution and i found this page. But i come up with no solution. Can you tell me what is the problem and the solution?

Related

dotnet cmdlet broken and continually tries to install .NET Framework 3.5

I am trying to get my dotnet CLI working. Everytime I invoke it, no matter the command it attempts to install .NET Framework 3.5, fails, and quits. Example:
PS C:\> dotnet --version
Installing .NET Framework 3.5...
Deployment Image Servicing and Management tool
Version 10.0.19041.844
Image Version: 10.0.19044.1348
Enabling feature(s)
[===================100.0%====================]
The operation completed successfully.
.NET Framework 3.5 should be installed
No installation media found!
Insert DVD or USB flash drive and run this file once again.
Press any key to continue . . .
I have used the dotnet-core-uninstall tool to remove everything that it can. I have uninstalled Visual Studio 2019 and 2017 and deleted the /.dotnet folder. The dotnet command issue persists with the same exact output, I don't even want 3.5 because that's not what my projects use (is that what the CLI runs on???). I don't know where it is pointing to or how to check and my google-fu powers have been exhausted.
I also do not have access to edit the system environment variables directly and have to use powershell to do so
FIXED
Turns out there was a C:\windows\dotnet.bat file that was taking precedence over the executables that get installed with any sdk. Deleting it fixed my problem.
The problem turned out to be a stray dotnet.bat file situated in a directory that preceded that of the desired dotnet.exe CLI in your $env:PATH variable, C:\windows\dotnet.bat
Removing the batch file fixed the problem (calling dotnet.exe - i.e. with the filename extension - would have bypassed the problem).
The problem was discovered via the following Get-Command call, which lists all command forms / executable paths for the name dotnet, with the effective one listed first:
Get-Command dotnet -All

MonoDevelop: "A platform service implementation has not been found" error

I took MonoDevelop 4.0.12 binaries from Debian's package archives (because could not find windows builds) and tried to run them under windows with this command (under windows):
"Mono-2.11.4\bin\Mono.exe" "monodevelop4.0.12\bin\MonoDevelop.exe"
it runs and works correctly for editing but when pressing F5 it fails to run the project being edited with this error:
"A platform service implementation has not been found"
(this same project compiles and runs with Mono from command line)
what is "platform service" and where can I find it for windows?
alternatively where can I find binaries of older versions of MonoDevelop?
I know about SharpDevelop but it cannot run on Mono (want to run same binaries of MonoDevelop on windows and linux with wine)

C# - Error when trying to run my application on the emulator in Visual Studio 2015 [duplicate]

I have Windows 8.1 pro with an AMD processor. I installed the Android SDK and Eclipse. It works but the problem is that when I Create AVD and launch it shows this error:
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!
I have already installed Intel Hardware_Accelerated_Execution_Manager and I have enabled Virtual modulation from the boot menu, but it's still not working.
Make sure you have installed HAXM installer on your SDK Manager.
After you download it and make sure you run the setup located in:
{SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe
Note: in Android Studio, the command "intelhaxm.exe" has been changed to "intelhaxm-android.exe"
If you get the error "VT not supported" during the installation disable Hyper-V on windows features. You can execute this command dism.exe /Online /Disable-Feature:Microsoft-Hyper-V. You will also need "Virtualization Technology" to be enabled on your BIOS
Open SDK Manager and download Intel x86 Emulator Accelerator (HAXM installer) if you haven't.
Now go to your SDK directory (C:\users\username\AppData\Local\Android\sdk, generally). In this directory, go to extras → Intel → Hardware_Accelerated_Execution_Manager and run the file named "intelhaxm-android.exe".
In case you get an error like "Intel virtualization technology
(vt,vt-x) is not enabled", go to your BIOS settings and enable
hardware virtualization.
Restart Android Studio and then try to start the AVD again.
It might take a minute or 2 to show the emulator window.
If you're running Mac, as #pedro mentions ensure you have the HAXM installer dowloaded via the Android SDK Manager.
Next install it! In finder navigate to /YOUR_SDK_PATH/extras/intel/Hardware_Accelerated_Execution_Manager/
Run and install the .mpgk in the following .dmg
Yosemite: IntelHAXM_1.1.0_for_10.10.dmg
Pre-yosemite: IntelHAXM_1.1.0_below_10.10.dmg
El Capitan: IntelHAXM_6.0.1.dmg - please install the IntelHAXM_6.0.1.mpgk file within - it will ask you if you want to reinstall it. Just say yes.
Example:
$cd /YOUR_SDK_PATH/extras/intel/Hardware_Accelerated_Execution_Manager/
$open IntelHAXM_1.1.0_below_10.10.dmg
First, you must enable Intel virtualization technology from the BIOS:
Second, navigate to your SDK ...\extras\intel\Hardware_Accelerated_Execution_Manager:
Then install intelhaxm-android.exe.
Note that if you can't find this file in the directory, make sure you install the package from your SDK manager:
This resolves it for me:
Go to (C:\users\%USERNAME%\AppData\Local\Android\sdk, generally).
Then go to Extras -> Intel -> Hardware_Accelerated_Execution_Manager and run the file named "intelhaxm-android.exe".
In case you get an error like "Intel virtualization technology (vt,vt-x) is not enabled", go to your BIOS settings and enable Hardware Virtualization.
Restart your studio
For AMD processors:
You don't need Genymotion, just create a new Virtual Device and while selecting the system Image select the ABI as armeabi instead of the default x86 one.
I faced the same problem recently.
I installed the HAXM installer on your SDK Manager:
And then installed the latest Intel HAXM driver:
https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement
And voila!!! The emulator works like a charm :)
For AMD processors:
Go to AVD manager and create a new virtual device as an ARM system image.
So I am having this issue and it seems that unless you are on Linux you will not be able to use HAXM. [EDIT: this is if you have an AMD chip (non intel) of course as that is the issue]
As stated on the Android Site;
Many modern CPUs provide extensions for running virtual machines (VMs)
more efficiently. Taking advantage of these extensions with the
Android emulator requires some additional configuration of your
development system, but can significantly improve the execution speed.
Before attempting to use this type of acceleration, you should first
determine if your development system’s CPU supports one of the
following virtualization extensions technologies:
Intel Virtualization Technology (VT, VT-x, vmx) extensions
> AMD Virtualization (AMD-V, SVM) extensions (only supported for Linux)
As others have mentioned Genymotion may be a solution.
I waste too much time on this, and none of the previous answers work. I find that Avast is the issue!!! If you have Avast installed in your system, you have to:
Go to settings tab --> troubleshooting, then you should UNCHECK the
"enable hardware-assisted virtualization"
Restart your PC and install the intelhaxm-android.exe if it is not installed. You can find it in C:\Users\{YOUR USERNAME}\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager
For those who are using Android Studio based on Jetbrains:
Goto Tools > Android > SDK Manager
Under Extras --> select the checkbox Intel x86 Emulator Accelorator
For those who are unable to use Nexus AVD can also try using Generic AVD.
Goto Tools > Android > AVD Manager
Then create a new Genreic AVD with something like QVGA and use for your app. This AVD does not use hardware acceleration.
I was facing this issue running the emulator inside Oracle VirtualBox. For me the solution was to modify the emulator to use an ARM CPU instead of x86.
You need to read (and post) the output of
sc query intelhaxm
as stated on http://developer.android.com/tools/devices/emulator.html#accel-vm
You open a command prompt window by right click on the start menu, choose execute and write 'cmd'.
See also Android Emulator Doesn't Use HAXM .
If you cannot get the emulator to work you might want to try out an easier alternative: Genymotion - http://genymotion.com/
First of all you should have Virtualization Enabled and you can do it from BIOS setting.
After that go to Control Panel\Programs and Click on "Turn Windows features on or off" option.
You will now have a pop up window, spot "Windows Hypervisor Platform" and enable it by checking the check box.
Restart your PC and now AVD should work without any issue.
For Android Studio 1.0.2:
First make sure Intel x86 emulator accelerator is installer. Check it in your SDK Manager. If not, then install it from there.
Go to your Android SDK folder,
**{SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager**
There you will find silent_install.bat.
Run it. It will create haxm_silent_run.log. After that, close and restart your Android Studio and then run your app.
It will work. In case of a problem, check the haxm_silent_run.log file.
As many other pointed out, Intel HAXM only supports Intel CPUs. Since Windows 1804 you can use Microsoft's Hyper-V instead of HAXM for the emulator. This also helps people who want to use Hyper-V for virtual machines as you need to disable hyper-v to run haxm.
Short version:
install Windows Hypervisor Platform feature
Update to Android Emulator 27.2.7 or above
put WindowsHypervisorPlatform = on into C:\Users\your-username\.android\advancedFeatures.ini or start emulator or command line with -feature WindowsHypervisorPlatform
enable IOMMU in your BIOS settings
Long version with more details:
https://blogs.msdn.microsoft.com/visualstudio/2018/05/08/hyper-v-android-emulator-support/
Requirements docs:
https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/system-requirements-for-hyper-v-on-windows
While creating a Virtual Device select the ARM system Image. Others have suggested to install HAXM, but the truth is haxm wont work on amd platform or even if it does as android studio does not supports amd-vt on windows the end result will still be a very very slow emulator to run and operate. My recommendation would be to either use alternative emulator like Genymotion (works like a charm with Gapps installed) or switch to linux as then you will get the benefit of amd-vt and emulator will run a lot faster.
I don't know if this is going to work but you can try this:
It's becoming pretty clear that the emulator team needs to do a better job of disseminating this information about how to use the emulator on AMD on Windows. This question comes up every week it seems.
First, uninstall HAXM.
Next, go here - https://developer.android.com/studio/run/emulator-acceleration#vm-windows and follow the instructions for Configuring VM acceleration with Windows Hypervisor Platform
Finally, if you get low framerates in your emulator instances, follow the instructions in the same page for Enabling Skia rendering for Android UI.
In my case, HAXM was already installed in SDK Manager. But every time I attempted to intelhaxm-android.exe, it would silently fail.
Finally, I extracted the internal installers out of intelhaxm-android.exe in 7-zip. Copied the three files to another directory and finally got a real installer to run. Ran without a hitch and HAXM issues were gone.

DLL dependency in different system or OS

Development Environment
Development OS : Windows 8.1 Pro
VS : 2013
App: Winform & WPF
MSSQL : 2012
EF : 6.0
EMGU.CV : 3.0.0
ffmpeg, Nreco, office.interop and several other plugins installed with app.
We have developed a vehicle tracking system with the help of emgu.cv for image processing. we are using capture method to grab images from the input video file and process images. Any way, the application is almost done. To test the application, we are trying it in several machines. Like with different cores / different OS (w7/w8/w8.1/w10) etc.
we are installing MSSQL express 2012, .net fw 4.5, 4.5.1, before using the app in pc's where vs is not installed.
in most of the case, our test pc has VS 2013, and in those pc, there are no problem running this application.
Some pc have adobe products but not VS. But they are running the application too.
But those pc, just have installed or dont have any adobe product or VS, they are crashing at the same point( in 5 pc).
Application: VehicleTrackingSystem.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException
Stack:
at Emgu.CV.CvInvoke.cvReleaseCapture(IntPtr ByRef)
at Emgu.CV.Capture.DisposeObject()
at Emgu.Util.DisposableObject.Dispose(Boolean)
at Emgu.Util.DisposableObject.Finalize()
Same solution is running in several pc as mentioned before. But in some cases, it shows (basically in win 7) System.dllnotfoundexception.
Its assumed that, some dlls are mismatching, may be because of VS installation or adobe product installation. I have tried Dependency Walker but in Positive PC and negetive PC all dll is similar. But the dll's file version is not same though.
how to solve this?

Using mkbundle to port Mono GTK# app to other platforms

I'm a long-time C# developer but new to Mono and, especially, Gtk#. I have developed a small app using C# and Gtk#. I need this app to work on Windows, Linux and Mac so I decided to go for Mono and, so far, it seems to be a cool framework.
What my simple app does is start up an XSP web server based on a local directory and port chosen by the user. Ideally, I would like my app to work without having to install the Mono framework at first, but this is not a must to begin with. I am using the following libraries:
using System;
using Gtk;
using System.Net;
using Mono.WebServer;
using System.Diagnostics;
I am developing on a Mac (Snow Leopard, 10.6.7). My executable works perfectly on my Mac. But I am having problems with Ubuntu and Windows. My app works partly on Ubuntu (11.04) -- it starts up and seems to be working but fails when I try to start the XSP web server, which seems expectable as Mono.Webserver is probably not installed on my Ubuntu machine. On Windows (7, 64-bit), my app crashes immediately when I double-click on it. The crash report tells me that a System.IO.FileNotFoundException error occurred. Probably due to the same missing XSP library?
Anyway, I looked around on the Internet and learned about mkbundle. I have performed the following setting as suggested by various forum threads:
export AS="as -arch i386"
I have navigated to the /bin/Release directory of my project and, then, run the following command:
mkbundle MivandoLocalServer.exe -o MivandoLocalServer --deps
But I am getting the following output, which eventually fails:
Compiling:
as -arch i386 -o temp.o temp.s
cc -g -o MivandoLocalServer -Wall temp.c `pkg-config --cflags --libs mono-2` temp.o
Package mono-2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `mono-2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'mono-2' found
temp.c:2:36: error: mono/metadata/assembly.h: No such file or directory
temp.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘assembly_bundle_MivandoLocalServer_exe’
temp.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
temp.c:18: error: ‘NULL’ undeclared here (not in a function)
temp.c: In function ‘mono_mkbundle_init’:
temp.c:22: warning: implicit declaration of function ‘mono_register_bundled_assemblies’
temp.c:22: error: ‘bundled’ undeclared (first use in this function)
temp.c:22: error: (Each undeclared identifier is reported only once
temp.c:22: error: for each function it appears in.)
temp.c: In function ‘main’:
temp.c:114: warning: implicit declaration of function ‘mono_set_dirs’
[Fail]
I really do not know what to do from here. I have MacPorts installed and I have read that this might cause some problems with regards to the pkg-config directory. Is this true? If yes, what will I have to do make it work?
I hope that somebody will be able to help me. Thanks!
Best regards,
Sebastian
PS. I have also posted this question in the forums at Mono's homepage but without any responses so far.
Update: I suspect MacPorts for interfering with my pkg-config directory setting. When I entered the following commands into my terminal, mkbundle allowed me to compile. But I am still encountering some problems.
export PKG_CONFIG_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/"
export AS="as -arch i386"
export CC="cc -arch i386"
Executing the following mkbundle command results in a Unix-archive of 4.9 MB that includes all the necessary dependencies. When I double-click on this new file on my Mac, a terminal window pops up and starts my app. Sweet! But this does not work in Windows nor in Ubuntu.
mkbundle MivandoLocalServer.exe -o MivandoLocalServerBundle --deps -z
What I would like to receive is a bundled executable that can be run in Windows and Ubuntu. So far I have not come across a solution that lets me do this. I tried to install MonoDevelop on my Windows 7 machine, copy my solution and build it there. But since my app is dependent on the Mono.WebServer2 library, I am not able to build it on Windows. I have not been able to find the Mono.WebServer2.dll to download for Windows anywhere on the Internet.
First of all this situation covers two separate issues which I will address separately:
Architecture - i386 only
Build and Packaging
1. Architecture
First of all, not all Windows and Linux machines run on the i386 architecture, so make sure you are using one that is. They are more likely to be i386, but Linux can easily run on many architectures and Windows has recently ventured into this path as well (they supported it in the past, but it quickly lost support) with the new tablet PC cpu types.
2. Build and Packaging
When targeting any operating system there are bound to be differences in the packaging paths so you should build for each target OS with that target OS. If you want mkbundle to work on Windows the whole toolchain needs to be installed there and Windows requires a special script to get it right, but since mkbundle was made for Unix-like OSs it should work on Linux without special considerations:
Create C# executable with mkbundle on windows
http://linux.die.net/man/1/mkbundle

Categories

Resources