slicybtw
slicybtw
Explore posts from servers
CC#
Created by slicybtw on 1/31/2024 in #help
Exit Error 139
im making an audio recorder using NAUDIO but everytime i run it exits with code 139 this my Program.cs
using System.Diagnostics;
using System.Collections;
using System.Drawing;
using Microsoft.VisualBasic;
using System.Data;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System;
using NAudio.Wave;

class Program
{
static void Main()
{
Console.WriteLine("Enter To Stop");

var fileName = "recording.wav";

using (var waveIn = new WaveInEvent())
{
waveIn.WaveFormat = new WaveFormat(44100, 1);

using (var waveFileWriter = new WaveFileWriter(fileName, waveIn.WaveFormat))
{
waveIn.DataAvailable += (s, e) =>
{
waveFileWriter.Write(e.Buffer, 0, e.BytesRecorded);
};

waveIn.RecordingStopped += (s, e) =>
{
waveFileWriter.Dispose();
waveIn.Dispose();
};

waveIn.StartRecording();

Console.ReadLine();

waveIn.StopRecording();
}
}

Console.WriteLine($"Recording stopped And Audio saved to {fileName}");
}
}
using System.Diagnostics;
using System.Collections;
using System.Drawing;
using Microsoft.VisualBasic;
using System.Data;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System;
using NAudio.Wave;

class Program
{
static void Main()
{
Console.WriteLine("Enter To Stop");

var fileName = "recording.wav";

using (var waveIn = new WaveInEvent())
{
waveIn.WaveFormat = new WaveFormat(44100, 1);

using (var waveFileWriter = new WaveFileWriter(fileName, waveIn.WaveFormat))
{
waveIn.DataAvailable += (s, e) =>
{
waveFileWriter.Write(e.Buffer, 0, e.BytesRecorded);
};

waveIn.RecordingStopped += (s, e) =>
{
waveFileWriter.Dispose();
waveIn.Dispose();
};

waveIn.StartRecording();

Console.ReadLine();

waveIn.StopRecording();
}
}

Console.WriteLine($"Recording stopped And Audio saved to {fileName}");
}
}
and this is my Program.csproj
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NAudio" Version="2.2.1" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NAudio" Version="2.2.1" />
</ItemGroup>

</Project>
2 replies
CC#
Created by slicybtw on 1/31/2024 in #help
C# not recognizing packages
i keep getting this error whenever i run my code using restsharp
mcs Program.cs
Program.cs(6,7): error CS0246: The type or namespace name `RestSharp' could not be found. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
mcs Program.cs
Program.cs(6,7): error CS0246: The type or namespace name `RestSharp' could not be found. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
this my code
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using RestSharp;
namespace Main
{
class Program
{
static void Main(string[] args) {



}

}

}
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using RestSharp;
namespace Main
{
class Program
{
static void Main(string[] args) {



}

}

}
i installed both NuGet And RestSharp, is there a way to fix this?
37 replies