Abdesol
Abdesol
CC#
Created by Abdesol on 11/19/2024 in #help
In App Billing purchased fetching on mac os causes restore failed issue sometimes
I am trying to use the InAppBilling plugin library by james montemagno (https://github.com/jamesmontemagno/InAppBillingPlugin) in an avalonia program. I have setup subscription and well configured the settings, info.plist and entitlements for this purpose. But the problem is, the library, when fetching from app store, it sometimes work and sometimes says failed due to restore issue, which I think means that it was not able to connect to app store and fetch purchases.. I saw a solution saying that we just have to keep trying in a loop, but still the error is not clearing. It particularly happens when I am trying to fetch purchased subscriptions list to check if the user has purchased our product or not. Has anyone ever faced this and found solution for it? Looking forward for any help. Thank you!
1 replies
CC#
Created by Abdesol on 10/12/2024 in #help
Using Azure ADB2C, new user claim is being sent on every sign in
I am trying to use azure ad b2c for user signup and signin. And after signup, I want to use the newUser claim to add the user email to queue storage for one of my azure functions to do a task around it. I am using ASP.NET as a web application for this. The problem is that azure ad b2c is caching the token in the browser. So, whenever I sign in, it is not sending a refreshed token. So, the newuser claim is being sent until I logout and login again. I wanted to manually check if the user is in database using microsoft graphs but the catch with this one is, by the time I am checking, the user is already in the users list.
2 replies
CC#
Created by Abdesol on 9/24/2024 in #help
visual studio installer including .net6.0 desktop runtime issues on installation
No description
1 replies
CC#
Created by Abdesol on 9/23/2024 in #help
Tried many things to fix this SqlClient exceptions, but no hope
It is a started project given to me, and I have to run the project first, and then exectue the stored procedures. We are using SQL Server for this. I am facing the below error as I run the project
Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot open database "database_name" requested by the login. The login failed.
Login failed for user 'User'.
Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot open database "database_name" requested by the login. The login failed.
Login failed for user 'User'.
And when I manually create the database instead of relying on the project to create it, I get the below error which I think is looking for the table:
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Table_Name'.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Table_Name'.
I tried with windows authentication as well as sql server authentication by creating new logins, but it keeps resulting on the same error. It is working for them, it is just not working on my pc. What are the possible things I could do to fix this issue? Thank you!
20 replies
CC#
Created by Abdesol on 9/18/2024 in #help
How to disable Microsoft Identity Web generated endpoints and redirection
So, in my project, I am trying to use microsoft identity for azure ad b2c configuration. But the problem is, it created its own endpoints, and now whenever I go to a non existing endpoint, it just chooses to redirect to the azure ad b2c provided remote url. It is weird what is going on. I only have it here in my asp.net webapi project:
builder.Services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>
{
builder.Configuration.GetSection("AzureAdB2C").Bind(options);
options.Scope.Add(options.ClientId!);
options.SaveTokens = true;
});
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C"));
builder.Services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>
{
builder.Configuration.GetSection("AzureAdB2C").Bind(options);
options.Scope.Add(options.ClientId!);
options.SaveTokens = true;
});
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C"));
Is there any obvious way I can remove the additional things created with it? I tried directly setting up open id connect.. but it still does the same thing. Thank you!
71 replies
CC#
Created by Abdesol on 7/4/2024 in #help
standard output from Process not giving any output for certain commands
I am using C# process to run some processes. The shell is cmd.exe, and running several types of scripts work. But, when I try to run python idle with the command cmd.exe /C python, it is giving no output and the process is also not exiting. It should have displayed the idle texts like it do on a normal terminal. The task function in which I am writing the output:
async Task OutputToConsole(StreamReader reader, Process process)
{
var buffer = new char[128];
while (true)
{
var read = await reader.ReadAsync(buffer, 0, buffer.Length);
if (read > 0)
{
var output = new string(buffer, 0, read);
Console.Write(output);
}

if (process.HasExited && read == 0) break;
}
}
async Task OutputToConsole(StreamReader reader, Process process)
{
var buffer = new char[128];
while (true)
{
var read = await reader.ReadAsync(buffer, 0, buffer.Length);
if (read > 0)
{
var output = new string(buffer, 0, read);
Console.Write(output);
}

if (process.HasExited && read == 0) break;
}
}
Is my approach wrong? Thank you!
82 replies
CC#
Created by Abdesol on 6/27/2024 in #help
How to handle outputs that alter the same line and remove lines while running a process?
Hello, I am trying to run a process in a C# program and the process output alters on the same line. Like, it shows percent, and then removes some lines and shows another line. Currently, using StandardOutput, I am not able to capture such scenarios. Is there any workaround to this? Thank you!
9 replies
CC#
Created by Abdesol on 6/20/2024 in #help
cancellation token to stop Console.ReadLine is only working on the first try
I have the following method I got from stackoverflow
async Task<string?> ReadLineAsync(CancellationToken cancellationToken = default)
{
var readTask = Task.Run(() => Console.ReadLine());
await Task.WhenAny(readTask, Task.Delay(-1, cancellationToken));
cancellationToken.ThrowIfCancellationRequested();
return await readTask;
}
async Task<string?> ReadLineAsync(CancellationToken cancellationToken = default)
{
var readTask = Task.Run(() => Console.ReadLine());
await Task.WhenAny(readTask, Task.Delay(-1, cancellationToken));
cancellationToken.ThrowIfCancellationRequested();
return await readTask;
}
I run it in a loop while passing it a cancellation token.. and the cancellation token is also in a loop, which means, I recreate it every time.. it works on the first try.. but after the recreation starts for the cancellation token, on await Task.WhenAny(readTask, Task.Delay(-1, cancellationToken)); cancellation token doesn't get to end first although it should have from the other concurrent task I manage to cancel the token. What could be a possible solution? Thank you!
93 replies
CC#
Created by Abdesol on 6/1/2024 in #help
when do I need to learn dotnet aspire?
I am trying to get into backend web dev with dotnet using asp.net core and the other tools. I was looking through the roadmap provided by Nick Chapsas (https://roadmap.sh/r?id=65d8624e66cd6d03d2d7efc9), and it put dotnet aspire before asp.net core basics. When I try to look into how I can learn dotnet aspire, they all are using some form of asp.net apis. So, is it necessary that I learn it first or let me do it after I get comfortable with asp.net core? Thank you!
7 replies
CC#
Created by Abdesol on 5/9/2024 in #help
On deserializing using Newtonsoft, I get default constructor required issue on mac but not on window
I am trying to use the ChatGPT nuget package <PackageReference Include="OpenAI" Version="1.11.0" /> which have to deserialize json for data processing. It works normally on windows, but on macos, I face the error below:
Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type OpenAl_API.EndpointBase+ApiErrorResponse. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute.
Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type OpenAl_API.EndpointBase+ApiErrorResponse. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute.
My target framework for windows is net8.0, and for macos, it is net8.0-macos. I have tried to switch to another ChatGPT package, but similar issue arises. Is there any fix for this issue? Thank you!
28 replies
CC#
Created by Abdesol on 1/19/2024 in #help
sql-net-pcl library, UpdateAll method is always returning 0, resulting in no update.
No description
20 replies
CC#
Created by Abdesol on 8/8/2023 in #help
✅ Bass Library Error: Device(Illegal Device Number)
I am having hard time with using the bass library on MacOS. I am not able to get rid of the Device(Illegal Device Number) issue after publishing. It works perfectly in debug mode. After publishing for microsoft windows too, it is having problem but I am not sure about that. But I am sure about the MacOS problem.
15 replies
CC#
Created by Abdesol on 7/22/2023 in #help
I am trying to reference a .csproj to my project, but it is throwing this error...
86 replies
CC#
Created by Abdesol on 4/26/2023 in #help
How to Dump and save objects to a file to load them later?
So, I was trying to use the Razorvine.Pickle library for this.. pickling them is working.. but unpickling is resulting in casting errors.. Is there any alternative I can use to save objects to a file? Thank you!
59 replies
CC#
Created by Abdesol on 3/20/2023 in #help
❔ Crossplatform disk formatting code
21 replies