We help IT Professionals succeed at work.

Why do I get the message "Message has been thrown by target of an invocation"?

I have a Windows 10 Pro workstation which is on a local domain and connected to various servers.  I use VS2015(Microsoft Visual Studio Community 2015) for developing in-house windows form applications for various departments. I noticed today that when I use the SQL SOE (SQL Server Object Explorer) when I have a solution or project open it does not function and errors out. If I open VS 2015 and then use the SQL SOE, it works fine.

The following is a screenshot of what it looks like when it functions correctly.
This is with no solutions or projects open.
This image is what it looks like when it is not working, it says it is connected but it won't show any data or let you interact with it from the SQL SOE.
This is with a solution open.
Funny thing is that when I have a solution open, even though I cannot see the objects from the server, I can still do a successful query! See!
Successful Query!

But if I open VS2015 open the SQL SOE and start browsing before I open a solution, I can see the server objects. But If I try to use one  I get the following error:

Message has been thrown by target of an invocation!
Does anyone know how to fix this issue or have had a similar problem? If so how did u fix it?
Comment
Watch Question

Nakul VachhrajaniSenior Manager
BRONZE EXPERT

Commented:
It looks like some sort of a bug. What Update level are you at (Help -> About Microsoft Visual Studio)? If you are not on Update 3, please upgrade to Update 3 (https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs).
Steve WilliamsProduct Design Engineer

Author

Commented:
Nakul, Thanks for responding. below is a screenshot of the About window.

about.PNG
Vitor MontalvãoIT Engineer
SILVER EXPERT
Distinguished Expert 2017

Commented:
Visual Studio is not really my area but did you check in Event Viewer for any error related to the issue?
Sometimes you can find there more detailed information that can lead you to solve this issue. Like this it really seems to be a bug.
Steve WilliamsProduct Design Engineer

Author

Commented:
Vitor, Thanks for responding. This happens regardless of project. I can create a new project and get the same result. I thought  at first it was something in my code but realized it has to do with Visual Studio.
Vitor MontalvãoIT Engineer
SILVER EXPERT
Distinguished Expert 2017

Commented:
I understood that, Steve. I'm just asking if you did check in the Event Viewer for more detailed information about the issue.
Steve WilliamsProduct Design Engineer

Author

Commented:
Vitor, I apologize. I misunderstood you. Your referring to Windows OS Event Viewer. No, I have not yet. I just opened it and will report anything that I feel is related to the  issue. Thanks!
Steve WilliamsProduct Design Engineer

Author

Commented:
ok So I looked thru the Event viewer and the only thing that post to the event viewer when try to use the SQL SOE  is the following:

Log Name:      Application
Source:        ESENT
Date:          3/8/2017 10:03:48 AM
Event ID:      103
Task Category: General
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      ENG-WS1.cartermanufacturingcoinc.local
Description:
devenv (6276) f2c7328c-de80-43c0-8d4e-17b7f532dbc1: The database engine stopped the instance (1).
 
Dirty Shutdown: 0
 
Internal Timing Sequence: [1] 0.000, [2] 0.000, [3] 0.000, [4] 0.000, [5] 0.015, [6] 0.000, [7] 0.000, [8] 0.000, [9] 0.000, [10] 0.000, [11] 0.000, [12] 0.000, [13] 0.000, [14] 0.000, [15] 0.000.
Vitor MontalvãoIT Engineer
SILVER EXPERT
Distinguished Expert 2017

Commented:
Is the SQL Server instance in the same machine as Visual Studio?
If so then you might running in lack of resources (CPU and especially RAM).
Steve WilliamsProduct Design Engineer

Author

Commented:
No the SQL Server Instance is running on a network server on our local domain. Which is a monster and has more than enough resources to function I think we have assigned 4 cores and 4GB of ram to this.  The Application is the only thing currently running on this server as we have moved most of our enterprise applications over to their own VM's on newer hardware. The tiny amount of data being used by this should not even show a small blip on the resources available for it.
Vitor MontalvãoIT Engineer
SILVER EXPERT
Distinguished Expert 2017

Commented:
Which is a monster and has more than enough resources to function I think we have assigned 4 cores and 4GB of ram to this.
How's a "monster" can only have 4 cores and 4GB? Mind that nowadays 4GB is almost nothing to a SQL Server instance.
Steve WilliamsProduct Design Engineer

Author

Commented:
Because  the monster has 32 cores total a128 gb of RAM if I choose to assign them to the VM on this SQL Server is running on. Even with two other big applications running on this VM We did not use half of what was available and did not have any issues. Due to expansion the other applications was reassigned to other hardware.
Steve WilliamsProduct Design Engineer

Author

Commented:
Also we use Citrix XenCenter for our VMware...FYI
Vitor MontalvãoIT Engineer
SILVER EXPERT
Distinguished Expert 2017

Commented:
Ok. So the big server is really a VMware server and then you're working with virtual machines. Anyway, 4GB still not enough for SQL Server even I don't think is the issue here unless the SQL Server machine has more applications installed.

I'm focused in this error message: "The database engine stopped the instance (1)."
Can you check the SQL Server error log to see if some related error has been registered in the same period?
Steve WilliamsProduct Design Engineer

Author

Commented:
Actually Microsoft  recommends only 1 GB for SQL Server Express. I 'd say I have that covered. this is a very small amount of data and doesn't require a full seat of SQL Server.

See Requirements for  SQL here CLICK HERE!
Steve WilliamsProduct Design Engineer

Author

Commented:
Ok here is the latest error log from that SQL Server Instance.
(see attached file ERRORLOG.txt)
ERRORLOG.txt
Matt BowlerDatabase Reliability Engineer
BRONZE EXPERT

Commented:
That error log is from when the server started up - you might need the log one before that one :)
Steve WilliamsProduct Design Engineer

Author

Commented:
Here is the last two error reports before the previous one I posted.

ERRORLOG1.txt
ERRORLOG2.txt
Matt BowlerDatabase Reliability Engineer
BRONZE EXPERT

Commented:
This message every hour suggests that there is some snap-shotting of guests going on - but that shouldn't cause the issue you are seeing.

"I/O is frozen on database"

I also see a lot of messages about starting up CalcTools. What is the result of this query?

SELECT is_auto_close_on FROM sys.databases
WHERE name = 'CalcTools'

Other than that - the shutdown doesn't look to have been cause by a SQL Server issue - you might need to look into the eventvwr logs on the guest and possibly look into whether the host has shut down the guest - do you have access to host level logs?
Steve WilliamsProduct Design Engineer

Author

Commented:
@MattSQL: Thanks for the reply, the result of the query was 1 in a column named "is_auto_close_on"

I think the snapshotting that is going on is the ShadowProtect Backup software we use for doing snapshots of all our servers once an hour.

when you are referring to guest are you speaking of the workstation or the server?

I have full access to anything on the host or client.
Database Reliability Engineer
BRONZE EXPERT
Commented:
By guest - I mean the VM that is running SQL Server, by host I mean your "monster" server that is hostiing the VMs :)

I'm not overly familiar with VS or with SQL express installations for that matter - but it appears that they will go into an idle state. I wonder if you need to refresh your SOE view to interact?

You could also consider changing the autoclose setting to off - that might maintain an active connection.

https://blogs.msdn.microsoft.com/sqlexpress/2008/02/22/understanding-sql-express-behavior-idle-time-resource-usage-auto_close-and-user-instances/


(I'm thinking that the SQL shutdown - while it should be investigated is probably not related to you original issue)
Steve WilliamsProduct Design Engineer

Author

Commented:
MattSQL, you get the points. I changed the AUTO_CLOSE Setting to false and that solved the issue. I want to thank all who contributed. Not only did we find a solution, I also learned a lot about the differences in SQL Express and SQL Standard. Thanks for your time fella's, it is greatly appreciated
Matt BowlerDatabase Reliability Engineer
BRONZE EXPERT

Commented:
Thanks Steve, glad you got it sorted :)