opened
mnikonov
username_0
Inside Windows 10 UWP project used Microsoft.Data.SQLite 1.0.0 package as data provider for Sqlite V3 Database

And when I'm performing any kind of Insert or Update operations and closing sqlite connection starts working Windows Definder and seems blocks sqlite database file.

As result app thread waits untill Windows Definder will not finish his job and connection close operatio takes about 3-6 seconds.

Windows version 14393.321

Code example 

`
using (var connection = new SqliteConnection(Const.ConnectionString))
            {
                connection.Open();
                using (var transaction = connection.BeginTransaction(IsolationLevel.ReadUncommitted))
                {
                    try
                    {
                        using (var command = connection.CreateCommand())
                        {
                            command.CommandText = "UPDATE...";
                            command.ExecuteNonQuery();
                            transaction.Commit();
                        }
                    }
                    catch
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
`

The same if call connection.Close()

as DB storage used LocalCacheFolder, SQLite connection has next params ;Mode=ReadWrite;Cache=Shared

I'm sorry if I chose the wrong place for the question

Also, seems, that this problem has place if DB size is bigger than 20Mb
Windows definder blocks SQLite database on connection Close
issue
created
rowanmiller
username_1
What name are you using for the database file? This is probably external, but maybe there is something causing Defender to focus on the file.
comment
created
mnikonov
username_0
The Db name is Rss.db, also I have tried to change file extension to  .sqlite3 but result was the same. For me also unclear why issue happens on connection close but not on transaction commit. I have checked on two different machines, but result was the same. Defender starts check, eats one processor core, and until he not finishes his background job code execution stops on Db close operation.
comment
closed
rowanmiller
username_1
issue
created
rowanmiller
username_1
There doesn't seem to be anything that we could do in EF or SQLite to avoid this issue. The easiest option is probably to add an exclusion to Windows Defender - https://support.microsoft.com/en-us/instantanswers/64495205-6ddb-4da1-8534-1aeaf64c0af8/add-an-exclusion-to-windows-defender.
comment
created
mnikonov
username_0
Sorry, but, it not an solution when app running on several thousands of consumer devices! End users see slow working app and will newer research real reasons of problem! And, all UWP apps,  @that uses SQLite will have that problem... May be, it possible somehow report that problem to Defender team?
comment
created
divega
username_2
@username_0 I have passed this issue to the team that maintains the SQLite version that ships with Windows. They maybe in a better position to help with this. I will let you know if they respond.
comment
created
divega
username_2
@username_0 the Windows Defender team has asked if you could provide support log files to help diagnose the issue on their side. You would need to execute the following in an administrator command prompt:

\program files\Windows defender\mpcmdrun.exe - getfiles
comment