Nemesis
System.Data.SQLite command executions slower if a transaction is not explicitly passed
I am coping a large amount of data row by row from one table to other. If I initialize a transaction with
BeginTransaction
and then create a command and go into the loop, and do transaction.Commit
at the end, it happens in seconds. But if I skip those steps and just create command and execute them in loop, it takes hours. What really happens if transaction is not created? Does each command execution use a separate transaction and do a commit each time, slowing the execution?
I couldn't find any documentation or explanation for this.10 replies
✅ RPC not available on trying to read a Excel workbook using interop
I was trying to use
Microsoft.Office.Interop.Excel
to open a excel file and read its content. but I get "RPC not available" error on Excel.Application.Workbooks.Open
and Excel.Application.Quit
any idea what could be going wrong?
No extra Add ins. Excel works fine manually.24 replies
❔ Process.Start doesn't open directory
I am looking for a generalized way of opening directories through C# application.
Most of the stackoverflow answers, such as this: https://stackoverflow.com/questions/1746079/how-can-i-open-windows-explorer-to-a-certain-directory-from-within-a-wpf-app/30939461#30939461, say
Process.Start(<directory>)
should work.
But I get exception:
System.ComponentModel.Win32Exception: 'An error occurred trying to start process 'file:///C:/dev/directory' with working directory '<workingdirectory>'. The system cannot find the file specified.'I am able to open the directory by
Process.Start("explorer", "C:/dev/directory")
. So, why is the other way not working?
Is the answer for an older version of C# or am I doing something wrong?6 replies
❔ Pass URI Parameter when the route of a Blazor page is set using @attribute
I am trying to implement a Blazor application, and for setting up the routes for the pages, I have a constants class with the path name and I am using
@attribute [Route($"/{Constant}")]
. But for one page, I want to pass a value when navigating to the page using the /path/{Parameter}
. But I can only see examples of doing that using the @page
. Is there a way to do that using @attribute
?2 replies
❔ Moq VerifySet not working with indexed property
I am writing an Unit test to verify if the indexed property ([]) is being called for a class. For that I am doing:
But I get an error saying the expression is not a setter.
VerifyGet
and SetupSet
work fine with index3 replies
❔ .NET MAUI Windows platform FilePicker not working on launching app in admin mode.
I am trying to launch a process from my app in admin mode. Only way I could find to launch the process and get output is to have the app in admin. for this I set the
requestedExecutionLevel
as requireAdministrator
in app.manifest
.
But on doing this, await FilePicker.PickAsync();
just closes the app without any error or crash.
What could be wrong with this?2 replies
❔ Launch .NET MAUI application in admin mode
I just started using the .NET MAUI framework. I am having some trouble launching the app in debug mode in Visual Studio. For normal .NET applications, launching Visual studio in admin mode and then starting the debug mode works, but in this case, the application doesn't get launched in debug mode.
Couldn't find any documentations on this either.
3 replies
❔ Are SqlCeConnection and SQLiteConnection objects thread safe?
I am trying to read rows from a table in a database parallelly. But my program is throwing different exceptions each time I run my program. I couldn't find any proper documentation on the thread safety of the connection objects. And the information that I did find online was conflicting. So I want to if the connections are thread safe. SQLite official documentation says that SQLite is thread safe if compiled with some flag. But I am not sure if the
System.Data.SQLite
is using that version of SQLite.2 replies
❔ In the SQlite library, which method will throw exception when the disk is full
I am trying to write an unit test for a scenario where the disk is full but data is being added to the database. In this scenario, will the error be from the
Execute
method of the command, or will it be from the Commit
of the transaction?2 replies
Call to async method waiting for execution even without await
I am trying to execute a async method multiple times in parallel. For this I am using the following code:
I added a sleep inside the method to verify parallel execution. But when I debug the code, the debug waits for the sleep time on the method call before moving ahead. What am I doing wrong here?
68 replies
How to read DateTime from SQLite database using System.Data.SQLite?
I have a sqlite database with a DateTime entry. Since SQLite doesn't have a DateTime data type, it stores it as Int64 time ticks. I am able to read the correct value of the column when using any SQLite database parser available online.
But when I try to read it in C#, using this code:
I only get 2022, the year part in the variable.
What am I doing wrong?
3 replies
xUnit test not running after signing the test project assembly
I have a test project with a single xUnit fact test. The test runs fine from the Test Explorer. But after I sign the test project assembly with a strong name, I get message saying
Test run finished. 0 Tests (0 Passed 0 Failed 0 Skipped)How do I make the tests run with strong name signed?
1 replies