System.Diagnostics.Activity threw an exception - sql-server

My reports were working like a charm until yesterday. But after un-installing and installing again these Nugets packages i.e. Jquery, Bootstrap, Microsoft reporting service control web and others, it not working any more. Although i can build and display new reports but not able to view the old ones. Could you please give me some hint to fix these. I am using visual studio 2017, sql server 2016.
This is the exact error
An unexpected error occurred in Report Processing.Exception has been
thrown by the target of an invocation.The type initializer for
'System.Diagnostics.Activity' threw an exception.Operation could
destabilize the runtime.
Thanks,
Ghaffar

Related

Schema compare - Unexpected exception caught during population of source model: Object reference not set to instance object

I've been running a schema compare in a database project in Visual Studio 2017, when I do this I get the following message in the Error List tab:
Unexpected exception caught during population of source model: Object
reference not set to instance object.
I found this blog, which appears to be the same issue, but the suggested solution (of removing the entry using the Select Target Schema window) has not worked despite trying it a few times.
The compare has (and does) work fine with the same project and database in Visual Studio 2013, so I have a work around, but it would be nice to know what is causing the problem (and leave VS2013 behind!)
I found a solution to this; for database projects there is a 'Target platform' setting in the properties (see below). I set this to SQL Server 2017 and the compare now works.
The default platform required appears to depend on the compatibility of the database (see https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level); while I required 2017 when I initially encountered this problem, a recurrence (against a database with a compatibility level of 120) needed SQL Server 2014 to be selected.
Oddly I have now seen that just switching the target platform back and forth can solve the problem e.g. I have a database project with SQL commands which were not present in SQL 2014, I ran the compare with a target of 2017 and it failed with the above error, ran with a 2014 target and it errors (as you would expect, since it does not understand the newer SQL functions), switch back to the 2017 target and the compare now works fine!
Edit: different job, different DB version (2019). Has all been working fine for months then this error cropped up. the above didn't work this time, so just in case anyone finds the same, the tried and tested closing and reopening VS sorted it!

SSRS preview stopped working

I'm using VS2017 and have added the parts necessary to use SSRS. I've created three reports and have successfully previewed them in VS. I deployed them to a report server and checked that they worked, and they didn't. The server reported an error. To solve that, I had to go into the Data Source Properties -> Credentials dialog and change the Credentials to "Use this user name and password."
That solved the error that the server reported. I deployed them once again, and they worked. However, now when I try to do a preview on any of the reports in VS, I get an error message that says:
an error occurred during local report processing
an error has occurred during report processing
I've already looked on here and Googled this, and most responses were for people using rdlc reports in applications, which I am not doing. Any ideas?

SSIS project fail to build - CPackage::LoadFromXML fails

I have been trying to solve a SSIS project related problem for a week now.
The SSIS solution/project has been working fine for two years but is not working at all for a second user after adding him two weeks ago.
The user can open the solution and execute packages after connecting to the source code via VSO/TFS or by using a local copy.
But after making changes to the project the other user got the error message (1) below when trying to build the project or executing a package.
Trying to import the project from the server results in another error message (2).
Most posts I have find refer to versions of SQL/visual studio (project created on a version that differs to the one currently in use) it is not appicable to my case
Any help or feedback highly appriciated.
My conditions are:
SQL Server 2014 (including SSIS) on win server 2012 r2
Dev machine with win 10 and SQL Server Data Tools 2013 (latest version)
Visual Studio Online for source code/versioning (GIT)
SSIS project deployment model
ProtectionLevel = EncryptSensitiveWithPassword
What I have tried so far:
Tried all cominations of user and dev machine
Tried different versions of Data tools
Tried to find differences in project/solution files as well as in packages to identify user related code etc.
Tried the SSI project with and without source control
Tried to change the Run64BitRunTime property
(1)
Error 1 Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException: The package failed to load due to error 0xC0010014 "One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.". This occurs when CPackage::LoadFromXML fails. ---> System.Runtime.InteropServices.COMException: The package failed to load due to error 0xC0010014 "One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.". This occurs when CPackage::LoadFromXML fails. at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.LoadPackage(String FileName, Boolean loadNeutral, IDTSEvents100 pEvents) at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events, Boolean loadNeutral) --- End of inner exception stack trace --- at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events, Boolean loadNeutral) at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events) at Microsoft.DataTransformationServices.Project.ProjectBuildItemInfo.Update(DateTime lastWriteTime, PackageItem packageItem, Project project, String projectDirectory) at Microsoft.DataTransformationServices.Project.ProjectBuildItemInfo..ctor(String name, DateTime lastWriteTime, PackageItem packageItem, Project project, String projectDirectory) at Microsoft.DataTransformationServices.Project.ProjectBuildValidator.RefreshCache(PackageItem item) at Microsoft.DataTransformationServices.Project.ProjectBuildValidator.CheckBuildItem(PackageItem item) at Microsoft.DataTransformationServices.Project.ProjectBuildValidator.CheckConsistency(String& errors, String buildLogFullName) at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.IncrementalBuildThroughObj(IOutputWindow outputWindow) at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.BuildIncremental(IOutputWindow outputWindow)
(2)
The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.
A bit late to the party I'm afraid, but I managed to resolve the 2nd error (in my case anyway) by using importing using the .ispac file rather than connecting to the catalogue in the database.

Entity Framework Profiler: unable to determine the provider name for provider factory of type 'system.data.sqlclient.sqlclientfactory'

When I use the Entity Framework Profiler 3.0 to log the real SQL statement in background, sometimes I give this exception:
Message: unable to determine the provider name for provider factory of type 'system.data.sqlclient.sqlclientfactory'.
Source: EntityFrameWork.
I give this error when I run the project in visual studio 2015 debugging mode, it displays a file browser to locate r5wldbbb.5.cs. I don't know what's this file and also it doesn't exist in Entity Framework Profiler folder. So when I cancel it I give the above exception and raise this error:
r5wldbbb.5.cs not found.
You need to find r5wldbbb.5.cs to view the source for the current call stack frame.
However, when I cancel the Entity Framework Profiler I don't give this error.
I use these programe:
Visual Studio 2015.
MSSQL Server 2014.
EntityFramework 6.
Any helps appreciated.
I finally fixed it.
The trick is to update the way you get and open the connection to the database:
var connectionString = ConfigurationManager.ConnectionStrings["yourContextName"].ConnectionString;
var connectionFactoryService = (IDbConnectionFactory)DbConfiguration.DependencyResolver.GetService(typeof(IDbConnectionFactory);
var DbConn = connectionFactoryService.CreateConnection(connectionString);
Let me know if it works for you too :) Also, don't forget to update the EF profiler to the latest version using NuGet.

SSRS - Could not find schema information for the element

Since the October preview of SSDT supports SSRS in Visual Studio 2015, I installed that and am trying to use it with my existing reports. I'm getting a bunch of errors, warnings, and messages, however. 61 messages exist that say the following:
Could not find schema information for the element /
'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner'.
I also get a warning for this report. Note that line 33 is just <Fields>.
[rsInvalidReportDefinition] The definition of this report is not valid or supported /
by this version of Reporting Services. The report definition may have been created /
with a later version of Reporting Services, or contain content that is not well-formed /
or not valid based on Reporting Services schemas. Details: Data at the root level is /
invalid. Line 33, position 28519.
The report code sections throwing these errors look like this:
<Field Name="PriorityId">
<DataField>PriorityId</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
The MSDN article for that field gives that schema link as the correct link, but navigating to it shows it doesn't exist. I tried several others on the server, but they all return the same error with the relevant URL.
The reporting server is running SQL Server 2008 R2, hopefully being upgraded soon to 2014. How can I resolve these errors and (hopefully) therefore the build error?

Resources