Jump to content
pieuponieu

Object reference not set to an instance of an object

25 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

So, for a couple weeks now I keep seeing this error (see title) pop up in the middle of game play, and it simply says "no details." Typically, I see my power and water icons start flashing in the background over every building, but I can't close out of the error and have to kill the app with the task manager. I have not unsubscribed from any assets since I started the city I'm playing on, and I don't have Advanced Vehicle Options (which, according to the guides, is a possible culprit) installed because I think it caused another issue I was having with people not moving in and residential buildings saying "0/0 households."

I searched the Steam forums and read the troubleshooting guides, and the only advice is essentially: unsubscribe from everything and start over. It's super annoying that this is the only way to deal with this issue.

I'm wondering, oh talented and godlike modders, if there's a way to create a mod that will identify the issue, or if there's a mod that already exists for this.

I found Isolated Failures, but the description indicates it's only for mods that break on startup.
http://steamcommunity.com/sharedfiles/filedetails/?id=505051010&searchtext=isolated+failures

There's Modtools, which doesn't explicitly say it can help with this issue, but I'm going to mess around with it.
http://steamcommunity.com/sharedfiles/filedetails/?id=450877484&searchtext=modtools

I have the building themes mod :thumb:, and I don't have any buildings in a theme that aren't loaded. 

Thoughts?

 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

press the copy button of the error window and paste the content here.

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Will do. It hasn't happened since I posted this, but next time I will grab that info.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    OK, here's the error info:

    Object reference not set to an instance of an object [System.NullReferenceException]

    Details:
    No details
    System.NullReferenceException: Object reference not set to an instance of an object
      at Building.SampleWalkingHeight (Vector3 worldPos, Single terrainHeight) [0x00000] in <filename unknown>:0 
      at HumanAI.SimulationStep (UInt16 instanceID, .CitizenInstance& citizenData, .Frame& frameData, Boolean lodPhysics) [0x00000] in <filename unknown>:0 
      at ResidentAI.SimulationStep (UInt16 instanceID, .CitizenInstance& citizenData, .Frame& frameData, Boolean lodPhysics) [0x00000] in <filename unknown>:0 
      at CitizenAI.SimulationStep (UInt16 instanceID, .CitizenInstance& data, Vector3 physicsLodRefPos) [0x00000] in <filename unknown>:0 
      at HumanAI.SimulationStep (UInt16 instanceID, .CitizenInstance& data, Vector3 physicsLodRefPos) [0x00000] in <filename unknown>:0 
      at CitizenManager.SimulationStepImpl (Int32 subStep) [0x00000] in <filename unknown>:0 
      at SimulationManagerBase`2[Manager,Properties].SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
      at CitizenManager.ISimulationManager.SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
      at SimulationManager.SimulationStep () [0x00000] in <filename unknown>:0 
      at SimulationManager.SimulationThread () [0x00000] in <filename unknown>:0 

    Now, I know there was a game update today, so you'd expect to get a few errors with mods or assets. This particular error has been happening quite often over the past few weeks, and there are dozens of threads on the steam workshop and on a FB group I'm in where other players are complaining of the same issue. Some people complain that it happens on game load, others, like me, find that it happens randomly in the middle of gameplay, as if it's caused by a growable asset somewhere in the city. And when it happens to me, the water and power zots go off above every building. 

    It might be worth noting that just a few weeks ago before this issue started, I was having another problem where residential buildings would grow but no one would move in, and the info panel said there were 0/0 households. It should say 0/1 or 0/3, but it said zero out of zero. I solved that problem by disabling everything, and then re-enabling groups of mods and assets. I narrowed it down to Advanced Vehicle Options. Not sure why that mod would cause such an issue, but disabling it solved the problem. Could be coincidence.

    It's also worth noting that this happens on new cities in which I start the game, subscribe to nothing new, unsubscribe from nothing, experience stable gameplay for hours, and then suddenly, I start getting the error. Again, I think it's a growable. 

    But the error info has no helpful information. 

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I saw this stack trace before and checked the code which causes it.

    It might be possible to write a mod to identify the asset which causes it.

    Does the error cause serious issues?

     

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    It just happened again. Same error details.

    Yes, it causes the game to essentially crash. I can't exit out of the error. When I click "OK" or the X in the corner, it just pops right back up, so I have to kill the game with the task manager and lose all my work. I try to save every few minutes, but you know how it goes. Sometimes it turns out I haven't saved for a half hour, and I lose a ton of work.

    I had to turn off autosave because it was causing crashes. It would say "saving" then "packaging" in the upper right corner, but it would get stuck on "packaging" and if I looked at the file in Windows explorer, it wasn't actually saved yet. But it would just be stuck on "packaging" without end. I've let it sit for a half hour that way to see if it would finish, but it wouldn't, and if I would initiate a new save, the game would crash.

    I appreciate any help.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I've had this aswell and it was due to a theme for theme manager. In my situation it always occured though when loading a game and your error msg seems a bit different.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    It just happened again. Same error details.

    Yes, it causes the game to essentially crash. I can't exit out of the error. When I click "OK" or the X in the corner, it just pops right back up, so I have to kill the game with the task manager and lose all my work. I try to save every few minutes, but you know how it goes. Sometimes it turns out I haven't saved for a half hour, and I lose a ton of work.

    I had to turn off autosave because it was causing crashes. It would say "saving" then "packaging" in the upper right corner, but it would get stuck on "packaging" and if I looked at the file in Windows explorer, it wasn't actually saved yet. But it would just be stuck on "packaging" without end. I've let it sit for a half hour that way to see if it would finish, but it wouldn't, and if I would initiate a new save, the game would crash.

    I appreciate any help.

    If this bug comes while you're already playing, it must mean that the asset causing it is not present when you open the save. The game crashes when it tries to spawn it.

    Maybe you could try to identify an asset that you have subbed to but that hasn't grown in your city yet ?

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    @Darf, it doesn't happen when I load the game, but I do use the theme manager. I have made a lot of my own themes and cloned some buildings too, in addition to themes from the workshop. I don't think I would want to play without that mod. It makes the game for me.

    That said, it is happening again in my new city, and it's happening about 4 minutes after I start my last save game. I've tried loading it three times and without fail, within a few minutes, it crashes. I'm convinced it's a growable of some kind. 

    But now the result is catastrophic, not just annoying, because I can't keep playing this city after putting in about 14 hours on it. Hrmpf. 

    @boformer, I know I am not the only person this happens to, so if you could make a mod to help isolate the problem, that would make a huge difference for me and other players. The fact that the problem can't be isolated by default is basically just stupid to me. A game developed with modding in mind should have some kind of debug tool built in.

    It just happened again. Same error details.

    Yes, it causes the game to essentially crash. I can't exit out of the error. When I click "OK" or the X in the corner, it just pops right back up, so I have to kill the game with the task manager and lose all my work. I try to save every few minutes, but you know how it goes. Sometimes it turns out I haven't saved for a half hour, and I lose a ton of work.

    I had to turn off autosave because it was causing crashes. It would say "saving" then "packaging" in the upper right corner, but it would get stuck on "packaging" and if I looked at the file in Windows explorer, it wasn't actually saved yet. But it would just be stuck on "packaging" without end. I've let it sit for a half hour that way to see if it would finish, but it wouldn't, and if I would initiate a new save, the game would crash.

    I appreciate any help.

    If this bug comes while you're already playing, it must mean that the asset causing it is not present when you open the save. The game crashes when it tries to spawn it.

    Maybe you could try to identify an asset that you have subbed to but that hasn't grown in your city yet ?

    I have over 800 assets, so that would take a long time! It's just frustrating to me that I essentially have to manually sift through a bunch of files to find the source of my problem. Code should be able to do that for me. 

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I don't know if there's a mod that lets you sort the assets by last subbed... this could help.

    You could also check which ones have been updated recently.

     

    Oh yeah and I think CO did a really bad job with this. It's incredibly easy to kill everyone's saves by doing a bad update for a simple asset. I find it lame that the game can't just "skip" a problematic asset but instead forces you to ctrlaltsuppr it :ducky:

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    I don't know if there's a mod that lets you sort the assets by last subbed... this could help.

    You could also check which ones have been updated recently.

     

    Oh yeah and I think CO did a really bad job with this. It's incredibly easy to kill everyone's saves by doing a bad update for a simple asset. I find it lame that the game can't just "skip" a problematic asset but instead forces you to ctrlaltsuppr it :ducky:

    Well, the issue has been happening for weeks, so it wouldn't likely be something I subscribed to recently. But I've always suspected it was a low density commercial growable, and now I think I have proof. I went back into the city and paused the game, then dezoned all my low density commercial except for terraced shops and pubs, which is mostly what I had, and the game continued to run without error. 

    So, I'm going to disable all my LD commercial and start re-enabling them to see if I can isolate the (hopefully) one faulty asset. 

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Keep in mind that this error very likely only happens when a citizen enters or leaves the building.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Ok, I made the mod. Download it here: https://www.dropbox.com/s/yzifqc6sqjzo02k/SampleWalkingHeightDebugger.dll?dl=0

    Place the mod in the folder "%AppData%\..\Local\Colossal Order\Cities_Skylines\Addons\Mods".

    Run the game and enable the mod in content manager

    Now open the affected save. The mod will display a welcome message:

    0kJ99v3.jpg

    Unpause the game and zoom in (so that the citizens are visible). The error will only appear when citizens are visible on screen.

    Look at the different districts of your city until the error occurs.

    The mod will display a debug window with advanced information. Take a screenshot. Usually the game will crash a few seconds after the window appears.

    The window also contains information about the exact error location in code (Error Code) and the asset which caused the error.

    Post the screenshot in this thread.

    Note that this mod will only work with the "System.NullReferenceException at Building.SampleWalkingHeight" error.

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    omg, @boformer, that is amazing. You are a true philanthropist!

    The game has been stable since I unsubscribed from a few commercial buildings earlier, but I am a skeptic and believe it will happen again (because it's been stable before). I should probably even resubscribe and try to cause it so I can use this mod. 

    I see people post about this issue a lot in other forums (on Steam, Facebook). Is it OK for me to share this with them when they do?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    This error has been causing me no end of trouble. It has just struck a new game I am working on. As the city is new I have NO commercial and NO industrial put in yet. All I have in is residential (low and high), plus some unique buildings and monuments, plus the dump and a basic incinerator. I was using the super wind thing (oops. For some reason the correct name has gone out of my head!). I do use themes. I had set the lower residential to only use low scale buildings and only use British buildings. I had just put in a bus station and two lines when it happened this time. 

    So it seems as though with me it isn't related to either commercial or industrial as they weren't in the city yet. It has to be caused I presume by residential. I hope that helps to clarify things for people. This error is really really wrecking my head. 

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Thanks boformer, I'm glad you've taken the time to make this for everyone. I can't seem to get this working in game though. I have tried placing it in the appdata mods folder as you've suggested and in the standard steam mods folder as well but it doesn't appear in the custom content menu.

    I agree wither everything mentioned here before though with regards to the walk height error. Contrary to popular belief I can reproducibly cause this error to go away which will be important for people looking over their city for suspect content to narrow down the culprit. That is; there is a breif downtime between error messages and if you use two hands on a scrollwheel mouse you can click and scroll out quickly causing you to zoom out to where pedestrians are no longer visible and thus the error disappears. This is how I first felt that this was an asset problem (Initially I thought it was a vehicle however these remain when zoomed out) Pedestrians and other small props do not. If an asset doesn't know where to spawn a pedestrian then that completely correlates with this being a building problem only close enough for pedestrians to be spawning.

    So, hopefully I've added some extra information to those like me who've been endlessly searching for the cause of the problem. Also, boformer, if you'd be so great to glance eyes over your file again to see if there's anything I might be doing to prevent it from working, that would be super!

    • Like 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    "Giant Tiger (Department Store)" from Steam is what was causing my error.

    But would be great to be able to debug and find the issue quicker.

    • Like 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Hey, I'm having the same problem here. When I click ok it just reopens. I can hit escape and it will still be there, and it will look like I can play the game, but I can't. I can post the log here.

    Object reference not set to an instance of an object [System.NullReferenceException]

    Details:
    No details
    System.NullReferenceException: Object reference not set to an instance of an object
      at Vehicle.CalculateTotalLength (UInt16 vehicleID) [0x00000] in <filename unknown>:0 
      at TrainAI.PathFindReady (UInt16 vehicleID, .Vehicle& vehicleData) [0x00000] in <filename unknown>:0 
      at TrainAI.SimulationStep (UInt16 vehicleID, .Vehicle& data, Vector3 physicsLodRefPos) [0x00000] in <filename unknown>:0 
      at VehicleManager.SimulationStepImpl (Int32 subStep) [0x00000] in <filename unknown>:0 
      at SimulationManagerBase`2[Manager,Properties].SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
      at VehicleManager.ISimulationManager.SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
      at SimulationManager.SimulationStep () [0x00000] in <filename unknown>:0 
      at SimulationManager.SimulationThread () [0x00000] in <filename unknown>:0 

     

     

    If anyone knows what any of this means, it would be greatly appreciated. Thanks!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Looks like it is related to trains. Got any custom train vehicles or custom train stations?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Yep, a lot of them.

    I'll list them out, and if you see some that might conflict or bug the game, please let me know. (the names are exact, separated by commas, and the capitalization may be wrong)

    2-track elevated station, 4-tracks elevated station, simple train station, NYC elevated pillar, UK train station - generic 2 (small), Drosovilas ELEVATED & 4TRACK trainstation., SuperStack 12m, bypass passenger station, modern train station, Vikersund train station, 4 track cargo station by Drosovilia, inner suburban station, Berlin elevated pillar 12m, cargo loading station (functional version), industrial elevated station, elevated train stop (read description pls), through module: expansion 2. Old brick station by Bad Peanut, train station one, rural station, Old brick station by Bad Peanut (modular), Expansion 1: Old brick module 2 Right by Bad Peanut, XAVE station Sourbrodt, simple 4 tracks train station, UPDATED Antwerp central st. 2/2

    for the SuperStack 12m and the Antwerp Central, the dashes are there because the text box needed to have the words joined.

    Thanks so much!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Try turning them all off in the content manager, load a new game (or a save without any of them) and see if the error is gone. If yes, then add them back one by one loading a game to see if the error pops up. Continue until you find the one causing the error.


    My workshop items

    Catch my latest project and future plans on my Patreon page

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    The message "Object not set to instance of Object" means that you are trying to use an object which has not been initialized. That is, you either set it to null, or you never set it to anything at all. The runtime throwing a NullReferenceException always means the same thing: you are trying to use a reference. The reference is not initialized (or it was initialized, but is no longer initialized).  More about....NullReferenceException

    Rino

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections