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..
Related
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
Trying to install Matlab run time on a docker image along with the project I'm working on, the project is an engine that will run a variety of measurements based on what is given to it, many of these measurements use Matlab. When I run the docker though I get an error that the "MWArray assembly failed to be initialized" or that a matlab dll is missing.
I'm trying to run this in Docker for Windows due to a company requirement, and have been unable to successfully get the DockerFile to recognize the MCR. Below is the code that I've been playing with to get the MCR onto a docker.
FROM mcr.microsoft.com/dotnet/framework/runtime:4.7.2-windowsservercore-ltsc2019
ADD http://ssd.mathworks.com/supportfiles/downloads/R2017b/deployment_files/R2017b/installers/win64/MCR_R2017b_win64_installer.exe C:\\MCR_R2017b_win64_installer.zip
# Line 3: Use PowerShell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Line 4: Unpack ZIP contents to installation folder
RUN Expand-Archive C:\\MCR_R2017b_win64_installer.zip -DestinationPath C:\\MCR_INSTALLER
# Line 5: Run the setup command for a non-interactive installation of MCR
RUN Start-Process C:\MCR_INSTALLER\bin\win64\setup.exe -ArgumentList '-mode silent', '-agreeToLicense yes' -Wait
# Line 6: Remove ZIP and installation folder after setup is complete
RUN Remove-Item -Force -Recurse C:\\MCR_INSTALLER, C:\\MCR_R2017b_win64_installer.zip
WORKDIR /app
COPY /Project/bin/Debug/*.dll ./
COPY /Project/bin/Debug/Project.exe .
ENTRYPOINT ["C:\\app\\Project.exe"]
Edit: I think I've found a working solution, following the idea from the other anwser about the ltsc2019 not working with Matlab 2017b. The below code has worked with 2017b inside a docker.
FROM mcr.microsoft.com/windows:1809
Windows Server 2019 is not supported by MATLAB R2017b, and support for it was not introduced until MATLAB R2019a.
For MATLAB R2017b you’ll need Windows Server 2016.
That’s not to say there may not be other issues as well.
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.
I am not sure if this is the right place to ask, but here it is: I created an ASP.NET Core web application, and copied all the files on my Ubuntu 14.04 server. I can compile and run without a problem, but now I want this application/web site to run permanently.
I followed all the steps described here https://docs.asp.net/en/latest/publishing/linuxproduction.html, installed nginx as reverse proxy to run with apache, and all of this run perfectly well.
BUT, trying to use supervisor and start the app from it, I systematically get an error /usr/bin/dotnet cannot execute binary file. But, if I move to be in the directory where the application is published, and manually type dotnet appname.dll it does start without a glitch.
I am not sure where to look to get this to work with supervisor. Thanks for your help (and if this question should be somewhere else, let me know)
I finally solved my problem, replacing the equivalent of the line command=bash /usr/bin/dotnet /var/aspnetcore/HelloMVC/HelloMVC.dll as described in https://docs.asp.net/en/latest/publishing/linuxproduction.html under "Configuring Supervisor" by a little script, far from perfect as I get a Warning: HOME environment variable not set.
Anyway, here is the script:
#!/bin/bash
cd /var/aspnetcore/foesuivi/
dotnet FoESuivi.dll
cd $HOME
As a windows programmer, I don't know much about bash scripting, but I certainly can see that I would need to give a value to $HOME before the cd command.
Anyway, after doing a chmod +x to the sh file, and replacing the command= with the full name of the sh file, it is now working, I can reboot and my site is immediately available.
I have a Raspberry Pi 2 with Raspbian. I am trying to start a Mono program called StartBrowser.exe automatically when the system boots. I added the following line to the /etc/rc.local file:
sudo mono /home/pi/Desktop/StartBrowser.exe
I also tried adding:
sudo /home/pi/Desktop/StartBrowser.exe
The program does not start on boot. When I run the same commands in the terminal the expected program starts. What do I need to do to start "StartBrowser.exe" on system boot ?
There are few steps to accomplish this:
Make sure your application can be run as Windows Service (check the documentation)
On RPi install mono-service with sudo apt-get install mono-4.0-service
Now you can add, at the end of the rc.local file, just before exit 0 line this call:
/usr/bin/mono-service -p:/directory/of/mono/app /directory/of/mono/app/app.exe
-p switch is mandatory, otherwise no additional DLLs will be loaded.
You can use "mono-service" to run programs in the background.
You can run your compiled code like so:
mono-service /home/pi/Desktop/StartBrowser.exe
By default, this creates a lockfile in /tmp. You can change this by using the -l: option.
In this way your service is running in the background