Wrong output value Using C# in VSCode (warning: CS7022) - c#

I'm currently new to C# and busy learning the basics and discovered this problem when starting: C# Beginner Code
But the output is Hello, World!: Hello, World!
Before Anyone asks did I remember to save changes when changing the text: Yes...I pressed CTRL + S.
(PS: If anyone could also help me fix the "warning: CS7022" Error I am Getting, it may be the problem for the wrong output problem I am facing.)
(Additional Information: Working on C:/ but storing data on E:/, Installed .NET SDK for VSCode (LTS version), Installed C# Extension and Code Runner on VSCode, Windows 11)
I copied the Error/Warning text and googled it but nothing really came up. I also searched "Wrong output C#" but nothing also.

Related

Could not complete testing: fitnesse.slim.SlimError: Error SLiM server died before Header Message could be read

I am trying to integrate Fitness with Visual Studio 2022. Have .NET 6.0 installed. Following the instructions given in this link. However, every time I run the Test it throws the error
Could not complete testing: fitnesse.slim.SlimError: Error SLiM server died before Header Message could be read. Unable to start test system 'slim': fitnesse.slim.SlimError: Error SLiM server died before Header Message could be read.
Looks like I am missing something very basic about Slim. Please let me know the resolution for this.
I was able to resolve this. The Target Framework RunnerW was pointing to was incorrect. It was pointing to Dotnet4.8. I modified this. But, and included into the fitsharp solution. Then, building solution from Visual Studio kept failing. Identified that this needed updating the Nuget package. Updating kept skipping every time stating the package was already installed. Was unable to build because of these reasons. Was finally able to have breakthrough when I built the solution from cli. Running the Test after this was successful.

Symbol.Barcode2 not found

I am working on an application for Motorola MC92NO. When I run the application, it works up until when you click on something that involves using the Barcode function. When you click on something that uses barcode functions, I get the following error message:
Error
An unexpected error has occurred in InventoryTracking.exe.
Select quit and then restart this program, or select details for more information.
File or Assembly name 'Symbol.Barcode2, Version = 2.9.0.0, Culture = neutral, PublicKeyToken = 6asdasdasfasdfasdf', or one of its dependencies, was not found.
When I select details, I get
TypeLoadException
And the same message as earlier.
I am very new to this and have been stumped about this issue.
It is important to note that, this device I am using is an IT test device and has been played around with a lot. For instance, I had a SQLServerException issue before this and that was because this device was missing some SQL .cab files. I got the .cab files from my boss and installed SQL Server and that problem is gone now.
So, do you guys think I am probably missing the barcode program as well? When I press the trigger, I see the laser beam. So I don't know.
Any help would be appreciated.
Thank you
Ensure that you copy the Symbol.Xxx libraries to your device, in the folder the application is installed.
These libraries are needed to translate .NET requests to the native barcode libraries.

Unable to run Console Application from Visual Studio: System.AccessViolationException

Description
When launching any Console Application, the code stops running immediately on an AccessViolationException (Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt). More info included in the next section.
Technical Symptoms
The Call Stack only contains external code:
Exception:Thrown: "The message filter indicated that the application is busy. >(Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))" (System.Runtime.InteropServices.COMException)
A System.Runtime.InteropServices.COMException was thrown: "The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))"
Time: 12/10/2015 10:59:55 AM
Thread:vshost.NotifyLoad[15344]
I created a new Console Application, containing only Console.WriteLine("Hello world!");
Running the new Hello world app results in the same exception and an identical
call stack.
Background
I suspect this has nothing to do with the issue, as I will explain, but I feel it is important to answer the obvious question, "what were you doing when the issue happend?" The last change I made was adding an extension to my Selenium Driver to hotkey logout from an application:
public static void logout(this IWebDriver Driver)
{
Driver.FindElement(By.TagName("body")).Click();
new Actions(Driver)
.SendKeys(Keys.Control + Keys.Shift + "x")
.Perform();
}
I also made a change in my App.Config file for one of my projects, but reverting this had no impact either.
Removing this code (the Driver extension and/or the App.Config change) does not resolve this issue. Retrieving a previous check-in does not resolve the issue. I am the only person currently working on this solution.
Discoveries
As mentioned, this is happening for an empty Console Application. Windows Form Applications launch fine. Unit Test Projects launch fine as well.
Research
I've spent hours looking into this. It seems like every similar issue I have looked into is pertinent to debugging only or a .NET version. For me, the issue occurs with a Release as well. Additionally, I have been using .NET 4.5 without any issues or changes on that front. I can't find any articles that seem worth posting, but I might be overlooking something.
Visual Studio Info
Microsoft Visual Studio Ultimate 2013
Version 12.0.30501.00 Update 2
.NET Version 4.6.00081 (just noticed it says 4.5 in my project properties, though)
Running as Administrator
Feedback
When Running from devenv.exe /SafeMode, Visual Studio loaded with:
An exception was encountered while constructing the content of this frame. This information is also logged in "C:\Users\UserName\AppData\Roaming\Microsoft\VisualStudio\12.0\ActivityLog.xml".
Exception details:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.VisualStudio.Shell.Interop.IVsShell5.LoadPackageWithContext(Guid& packageGuid, Int32 reason, Guid& context)
at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.GetPackage()
at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()
Additionally, when trying to run, I get an error message of "Error while trying to run project: Invalid Pointer" (again, VS in devenv.exe /SafeMode - see how to run visual studio without plugin and all third party feature if unfamiliar)
Please let me know if I can provide any additional information.
It may be because when you name the project you can't put spaces, I put them and it gave me a AccessViolationException aswell, try using capitals to separate your words, but only use letters and no spaces to be sure.
I also faced this issue with Visual Studio 2010. More interestingly I had several projects in my solution (Console application, WPF application, Windows Forms application) but it was failing only when, I was setting the project which was of type "Console Application" as start up project. Following change finally helped me nail down the issue: Go to project properties of the console application project -> Go to "Debug" tab -> Go to "Enable Debuggers" section in right pane -> Check the "Enable unmanaged code debugging" check box as shown in the snapshot below. Root cause of why it happened is still not known to me. Only thing which I observed as fishy was that there were lot of windows updates which had got installed on my machine the previous night which mostly constituted of office updates and OS updates (More than a dozen KB articles).

.net application won't run on developer machine but works on visual studio

First of all I want to apologise if this question was answered before, I've searched but I didn't find anything [maybe didn't searched correctly]
I've developed a very simple console application, which doesn't do anything else but display a random number from 2 integers.
Code:
int miNumber;
int mNumber;
bool ok = false;
try
{
miNumber = Convert.ToInt32(minNumber);
mNumber = Convert.ToInt32(maxNumber);
ok = true;
}
catch (Exception)
{
Console.WriteLine("Only digits allowed!");
Console.ReadKey();
ok = false;
}
if(ok)
{
// Generate
var x = new Random();
Console.WriteLine(string.Format("Generated number from {0} and {1} is {2}", miNumber, mNumber, x.Next(miNumber, mNumber)));
}
However, this application works on:
Developer machine if runned with visual studio [debug]
Another PC with .NET 4.0 installed.
My laptop
This application does not work on:
My own computer. If I copy test.exe in another location, it won't run.
I'm sure that I got .NET 4.0 since I run on Windows 8.1, I even tried to install it again but it says I already have it. [Anyways the Visual Studio could'nt make application in .net 4.0 if there wasn't the framework installed]
I've checked Event Viewer and I ain't see anything displayed such as error or something inputted by the system at the moment the application was run.
I tried:
Running the application from CMD [Stucks] [Screenshot added] Screenshot
Running the application from explorer.exe [Stucks and displays the loading cursor like forever]
If I close the console application displayed, the executable is still running. I tried to kill it from CMD using 'taskkill /f /im test.exe' with highest privilege available Killing however, I'm receiving an error at my second try.
The executable is still there, I can't delete or move the exe until I restart the machine.
Thanks for any help provided because I really don't get it what's the issue here.
Thanks to #HansPassant https://stackoverflow.com/users/17034/hans-passant
The problem is from Avast Antivirus.
I've disabled Avast shields and the application is working properly.
I really don't get why avast doesn't like .NET Frameworks so much but, at least is a temporary fix.
Thanks.
I'm pretty sure it could be some kind of anti virus application that's blocking your application.
Update Too late :D

MonoGame - Error 9009 & IgnoreMe.dll not found

i've just installed MonoGame and XNA and i'm having some issues from the jump, from googling it seems as though i need to add 'C:\Windows\System32' to my path environment variables, i've tried adding it here
but i'm still getting these errors
Error 1
The command "SETX MONOGAME_PLATFORM "PSM" > NUL" exited with code 9009. MyMonoGameContent
Error 2
Metadata file 'C:\Users\Benji\documents\visual studio 2013\Projects\myMonoGame\MyMonoGameContent\MyMonoGameContent\bin\PSM\IgnoreMe.dll' could not be found C:\Users\Benji\documents\visual studio 2013\Projects\myMonoGame\myMonoGame\CSC myMonoGame
This happens when i try to compile after referencing my content project
i'm following these http://rbwhitaker.wikidot.com/monogame-tutorials
no idea what's up, was that the wrong place to set the enviroment variable? i've tried looking for a user property sheet but can't find one in my project
I wouldn't expect that you would want to create content for the PSM (PlayStation Mobile). Check the targeted platform of the ContentBuilder project to ensure you are building for Windows.

Categories