question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException in apps on Windows 8 RTM

See original GitHub issue

I migrate an app from windows 8 RP to RTM.

I didn’t have problem on RP but on RTM SQLite throw very often an exception when my app launch.

Here is the exception details:

  System.NullReferenceException was unhandled by user code
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=mscorlib
  StackTrace:
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
       at SQLite.SQLiteConnection.GetMapping(Type type) in \SQLite.cs:line 234
       at SQLite.SQLiteConnection.CreateTable(Type ty) in \SQLite.cs:line 308
       at SQLite.SQLiteAsyncConnection.<>c__DisplayClass1.<CreateTablesAsync>b__0() in \SQLiteAsync.cs:line 

94
       at System.Threading.Tasks.Task`1.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()

Can you investigate on it?

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
jamiepenneycommented, Dec 10, 2012

I have the same problem. It happens when I try to call CreateTableAsync like so:

var connection = new SQLiteAsyncConnection("music");
await connection.CreateTableAsync<LibraryEntry>();

And LibraryEntry is this:

    public class LibraryEntry
    {
        [PrimaryKey, AutoIncrement]
        public int Id { get; set; }

        public LibraryEntry() {}

        public LibraryEntry(string path)
        {
            Path = path;
        }

        public string Path   { get; private set; }
        public string Artist { get; set; }
        public string Album  { get; set; }
        public string Title  { get; set; }
        public uint TrackNumber { get; set; }
    }

The Create table call is in an async method that gets called on app startup. I have the same stack trace as the OP.

0reactions
stevebgitcommented, Oct 11, 2014

http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/WPH-B306#fbid=

At about 34:00, in Andy Wigley’s video above, there is what appears to be a good solution to avoiding the async race condition problem, when accessing a sqlite db ( even though he’s lecturing about SqliteRT).

The GetDatabaseAsync() function, specifically.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix the error: System.NullReferenceException
A NullReferenceException exception is thrown when you try to access a member on a type whose value is null. A NullReferenceException exception ...
Read more >
Null reference exception on installed application
The code on the development machine works perfectly, but when I install it on the target machine it is giving a null reference...
Read more >
Cannot run the Netflix Modern app on Windows 8.1
I'm trying to run the Netflix Modern app on my PC running Windows 8.1. To be clear, this is the app that you...
Read more >
NullReferenceException when reading a linux dump taken ...
Hello,. I want to be able to open memory dumps taken on linux. I purchased dotMemory since it is advertised that it supports...
Read more >
Targeting your Windows 8.1 app to the correct version of ...
In the Solution Explorer, expand the References folder, right-click the reference to the pre-release version of Windows 8.1 (e.g. “Microsoft.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found