Unable to run integrated console Visual Studio Community 2017 - c#

I just installed Visual Studio Community 2017 on my mac, created a console C# project and trying to run the hello world string, but it keeps on opening the mac console when running the script, and moreover, it looks like it crashes somehow
bash -c 'clear; cd "/Users/gb/C#_Projects/TestProject/TestProject/bin/Debug"; "/Library/Frameworks/Mono.framework/Versions/5.8.0/bin/mono32" --debug --debugger-agent=transport=dt_socket,address=127.0.0.1:51188 "/Users/gb/C#_Projects/TestProject/TestProject/bin/Debug/TestProject.exe" ; echo $? > /var/folders/s_/sljf42_d01bdxlb5s_rwgsj80000gn/T/tmp231b1334.tmp; echo; read -p "Press any key to continue..." -n1; exit'; exit
macbook-pro-de-gb:~ gb$ bash -c 'clear; cd "/Users/gb/C#_Projects/TestProject/TestProject/bin/Debug"; "/Library/Frameworks/Mono.framework/Versions/5.8.0/bin/mono32" --debug --debugger-agent=transport=dt_socket,address=127.0.0.1:51188 "/Users/gb/C#_Projects/TestProject/TestProject/bin/Debug/TestProject.exe" ; echo $? > /var/folders/s_/sljf42_d01bdxlb5s_rwgsj80000gn/T/tmp231b1334.tmp; echo; read -p "Press any key to continue..." -n1; exit'; exit
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
I tried to change the configuration in the build option by unchecking "Build with external console" but each time I build this is checked again...

To prevent the external Mac console form opening, you have to right click your project (not the solution) and click "Options". Under the Run option, click on "Default". Uncheck the box "Run on external console". In my case I had to restart visual studio to have that working.
If you don't see the "Hello" output, go to View->Pads->Application Output, then you can pin that, or dock it.
But if you need to insert text, such as with Console.ReadLine(), you'll have to use the external console anyway.

Related

Visual Studio 2019 C# Docker debugging process attach error

I'm trying to debug a Linux container that runs a C#/.NET 6.0 console application from Visual Studio 2019 (version 16.11.10).
When I use Debug / Attach to Process... to connect to my running container and attach to my process, I get the error:
Failed to launch debug adapter. Additional information may be available in the output window.
Unable to find debugger script at '/home/dockeruser/.vs-debugger'
For company security purposes, I'm running my container workloads as user dockeruser, but I can reproduce this when I adjust my Dockerfile to run as user root. The error message changes into
Unable to find debugger script at '/root/.vs-debugger'
Output shows
Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
Initialization log:
Determining user folder on remote system...
Checking for existing installation of debugging tools...
Downloading debugger launcher...
Creating debugger installation folder: /home/dockeruser/.vs-debugger
Copying debugger launcher to /home/dockeruser/.vs-debugger/GetVsDbg.sh
Failed: Failed to copy files.
Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
Failed: Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
The program '[1] dotnet' has exited with code -1 (0xffffffff).
I can work around this by docker exec'ing a bash session on my container and running GetDbgVs.sh as detailed in https://stackoverflow.com/a/68950674/17273131, but its a pain to do - it feels like something is misconfigured.
I've already verified that my windows identity is a member of the windows docker-users group.
While not the answer I wanted, I've got a 1-liner shell workaround that I execute on my container when I want to debug attach with VS2019, once I know my <CONTAINER_NAME>. This may be useful to others with this problem.
docker exec -u root <CONTAINER_NAME> sh -c "apt-get update && apt-get install wget -y"; docker exec <CONTAINER_NAME> sh -c "mkdir -p ~/.vs-debugger; wget https://aka.ms/getvsdbgsh -O ~/.vs-debugger/GetVsDbg.sh; chmod a+x ~/.vs-debugger/GetVsDbg.sh"
The first command installs wget as root
The second command downloads GetVsDbg.sh to ~/.vs-debugger

VisualStudio 2017 runs .exe when building on external console

I'm trying to learn some C# and am currently using the internal console for outputs, but when it comes to keyboard inputs, I've read that it can not be done in the internal console on VS 2017 for Mac.
So I try to do it on external console, but all I get is this :
bash -c 'clear; cd "/Users/gb/Projects/reTest/reTest/bin/Debug";
"/Library/Frameworks/Mono.framework/Versions/5.8.1/bin/mono32"
--debug --debugger-agent=transport=dt_socket,address=127.0.0.1:56795 "/Users/gb/Projects/reTest/reTest/bin/Debug/reTest.exe" ; echo $? >
/var/folders/s_/sljf42_d01bdxlb5s_rwgsj80000gn/T/tmp563f24ea.tmp;
echo; read -p "Press any key to continue..." -n1; exit'; exit
I guess the console tries to execute a .exe application which is not possible in this case !
It's a console project by the way... I haven't found any solution for that so far.
Thks.
After further researches I found out that my bash was kind of corrupted somehow so I modified the .bash_profile file which had some extra inconvenient text..

Visual Studio Code output window stays empty using scriptcsRunner

I've been trying to fiddle around with Scriptcs and since I don't always want to fire up Visual Studio and use the interactive window, I'd tried my hand with Visual Studio code.
These are the steps I've taken:
#powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scriptcs-contrib/svm/master/install/installer.ps1'))" && SET PATH=%HOME%\.svm\bin\;%HOME%\.svm\shims\;%PATH%
svm install 0.15.0
VS Code -> ext install scriptcsRunner -> Restart VS Code
Using a command prompt and issuing scriptcs [enter] Console.WriteLine("foo"); [enter] returns foo.
Using sublime Text 3, I get the same results. However, in Visual Studio code executing it with Ctrl + Shift + R gives me an empty Output window. How can I debug and rectify this?

Web deployment task failed (This access control list is not in canonical form and therefore cannot be modified)

Publishing ASP.NET MVC 4 application to IIS 8 on my machine giving the following error :
This access control list is not in canonical form and therefore cannot be modified.
I am under Windows 10 and using VS 2013 Ultimate.
I installed web deploy 3.5 from web platform installer 5, and I made sure that the services are working
Solution 1
I was able to solve this problem in the following way
Go to IIS
Right click on the website that you are publishing to and select Edit Permissions
Click the Security tab.
Click on Edit button
A Message box will appear which tell that the Permission was not correctly ordered.
Click Reorder on that message box.
Solution 2
Open the Command prompt (CMD) and execute the following two statements
icacls.exe C:\inetpub\wwwroot /verify /T /C /L /Q
icacls.exe C:\inetpub\wwwroot /reset /T /C /L /Q
note : Maybe you will want to open the CMD with Administrator privilege (Maybe I am not sure)
Cheers
You can run the following command to fix it
command prompt
icacls.exe C:\inetpub\wwwroot\<VIRTUAL DIRECTORY> /verify /T /C /L /Q
// If any entries are reported as being not in canonical order then run:
icacls.exe C:\inetpub\wwwroot\<VIRTUAL DIRECTORY> /reset /T /C /L /Q
Source
powershell
$path = C:\inetpub\wwwroot\<VIRTUAL DIRECTORY>
$acl = Get-Acl $path
Set-Acl $path $acl
Source
You can prevent this problem by modifying your Visual Studio package generation parameters: In the PropertyGroup section of your pubxml file, add
<IncludeSetACLProviderOnDestination>False</IncludeSetACLProviderOnDestination>

Unable to set the current stack frame

I opened the command window in Visual Studio 2015 CTP and given the following command
>k ef migration add [migration name]
>k ef migration apply
It is giving the response message as Unable to set the current stack frame.
How to solve the above issue.
I am Scaffolding a new migration for the pending model changes and applying them to the database from the command line.
I am following on View components and Inject in ASP.NET MVC 6
In an administrator command window, change the directory to the project directory. The project directory contains the project.json file.
Then run the commands from there.
So in short, don't use the visual command window, but an actual windows command window.
You should follow these steps to install the K command:
Install the K Version Manager (KVM)
Open a command prompt with Run as administrator.
Run the following command:
#powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.ps1'))"
The script installs KVM for the current user.
Exit the command prompt window and start another as an administrator (you need to start a new command prompt to get the updated path environment).
Upgrade KVM with the following command:
KVM upgrade
You are now ready to run EF migrations.
The source is your shared link "View components and Inject in ASP.NET MVC 6"
Than you need to run commands at cmd.exe

Categories

Resources