β System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
I've been programming for a handful of years, but never to a level of complexity i've been comfortable with in C#, however now in university me and a friend have been taked with creating a small little programming language transpiler as a side project by our tutor. It's a simple Console application which can read information and then will (not complete yet) dump it into a C# file.
Somehow I managed to do this in python before, but C# is giving me some headache.
Code:
Input:
43 Replies
Error:
Well, one of the substrings is trying to access a part of the string that doesn't exist
Using a debugger would help to figure out what the string is at which time
Hm okay
thank you, i'll look into that and get back to you
@ZZZZZZZZZZZZZZZZZZZZZZZZZ any specific way to do that in VSCode with Mono, i'm on macOS π€£
- yes i do realise i shot myself in the foot there
Why tf are you using Mono?
idk was recommended by our uni
They're full of shit then
I don't do a lot of C# development π
.NET nowadays is fully cross-platform, no need for workarounds like Mono
oh fr?
Just get a .NET 7 SDK and you're good
For debugging, get the "C# Dev Kit" extension for VS Code
i assume microsoft publishes the binary links for it
alright
I already have the c# DEV KIT
*
sorry caps lock
Ypu're already good, then
anything else I need to compile & run
Nope
Just the SDK
Right, is that an extension or binary?
Wym?
how would I install it on macOS
is there a download page
or is it a VSCode extension
Cool
this
it infuriates me I was using mono π
@ZZZZZZZZZZZZZZZZZZZZZZZZZ it says there is no C# project currently loaded
Where does it say that?
Well, do you have a project?
Or is it just a loose
.cs
file?loose .cs file
You need a project
dotnet new console
to create a new console project, for exampleright, tysm
still says the same
I moved the program to Program.cs
Close VS Code, go to the directory with your
.csproj
file, open VS Code there?it works, but it's requiring an input and i don't know where i can place it
my terminal is blank π
Sorry i get these are quite nooby questions, it'd be mildly easier if i had access to standard visual studio tbh
There's always Rider
If you're a student you can get the license for free
$freerider
There are two ways to get Rider for free:
Being a student: https://www.jetbrains.com/community/education/#students
Using it for an OSS project: https://www.jetbrains.com/community/opensource/#support
To be honest, dunno how to use the debugger in VS Code
Neither π
I just bodge my way until it works πΊ π
Debugging C# in Visual Studio Code
See how you can run and debug your C# source code
thank you
It's quite late so i'll handle that tomorrow but thanks for all your help
Anytime
JetBrains
Early Access Program - Rider: Cross-platform .NET IDE
.NET IDE based on the IntelliJ platform and ReSharper. Supports C#, ASP.NET, ASP.NET MVC, .NET Core, Unity and Xamarin
@AJStrong Visual Studio is the best for C# debugging. You can get the free community version
Not on Mac or Linux, tho
Oh no rippp
Which are my two primary operating systems
Itβs fine I have a spare laptop I can throw Win11 on, that was my plan anyway
Get yourself Rider, you won't regret it
I will β€οΈ I love JetBrains tbh
They better have a Dracula theme >:3
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.