Exception when trying to reference Azure Analysis Service Tabular Model C# - c#

The problem I get is an exception when I try to reference Azure Analysis Service Tabular Model.
Message=The value '2' is unexpected for type 'DataSourceType'.
Source=
StackTrace:
Microsoft.AnalysisServices.Tabular.ObjectFactory.CreateDataSourceFromRowset(IPropertyReader reader)
at Microsoft.AnalysisServices.Tabular.DdlUtil.LoadDataTable(ObjectType objectType, DataTable table, DictionaryobjectMap, StringComparerInfo comparerInfo)
I found the same problem here Exception when referencing SSAS Tabular model in C# but there is no solution for it.
Microsoft.AnalysisServices.Database db =
SSASConnection.Instance(Parent.Name).Databases.Find(Id);
if(db.Model != null) // Here it breaks!!!

I found a solution for this.
The problem was that I used Microsoft.AnalysisServices.dll 13.0.0.0 version
I updated it to Microsoft.AnalysisServices.dll 14.0.0.0 version and now all works fine.

Related

IBM.Data.DB2.Core error in new DB2Connection(connectionString)

We have the IBM.Data.DB2.Core (3.1.0.300) nuget package installed in our .netstandard2.1 application library, to connect to an external DB2 instance on prem.
On running the following code from a .net core azure function v3 Windows 64bit (from a netcoreapp3.1 project)
var connectionString= "Server=DB2_IP:DB2_Port;Database=DB2_DBNAME;UID=DB2_UserId;PWD=DB2_Password;"
var connection = new DB2Connection(connectionString);
(note the values in the connection string are placeholders for anonymity)
We are receiving the following error
IBM.Data.DB2.Core.DB2Exception (0x80004005): ERROR [58005] [IBM][DB2.NET] SQL0902 An unexpected
exception has occurred in
Process: 21308 Thread 33 AppDomain: Name:Microsoft.Azure.WebJobs.Script.WebHost
There are no context policies. Function: AESEncryptADONET (Encryption Info)
CallStack: at System.Environment.get_StackTrace()
at IBM.Data.DB2.Core.DB2ConnPool.HandleUnknownErrors(String strFncMsg, Exception exception, Boolean bThrow)
at IBM.Data.DB2.Core.DB2ConnPool.EncryptString(String value)
at IBM.Data.DB2.Core.DB2ConnPool.ReplaceConnectionStringParms(DB2Connection connection, String szValue, DB2ConnSettings& pSettings, DB2ConnSettingsInternal& pSettingsInternal, Boolean bAttach, Boolean pushDownStrAppended)
at IBM.Data.DB2.Core.DB2Connection.set_ConnectionString(String value)
at IBM.Data.DB2.Core.DB2Connection..ctor(String connectionString)
Does anyone have any idea where we're going wrong, or alternatively have a coherent end-to-end guide on the setup that may give me a clue.
All documentations I have found thus far has been rather sparse and a little inconsistent.

Stackoverflow exception in JSON.net

I am using MongoDB + C# + Knockout. Recently I have added new column "SubmitCount" of data type "int" in my existing database (MongoDB).
When I query mongodb using C#, it is giving me Stackoverflow exception with no stack trace. I figured out it is giving me exception at:
var query = Query.EQ("Shelf", "Create");
var result = CollectionName.FindAs<BsonDocument>(query);
//Throwing exception at below line
var trialList = (from clnTrial in result
select new { TrialID = clnTrial["TrialID"].ToString(), CreatedBy = clnTrial["CreatedBy"].ToString() }).Distinct().ToList();
It was working properly before adding new column.
I searched a lot but found nothing. Any help would be appreciated.
EDIT: I just rerun the code removing "ToList()" now it is not giving exception. :-/. But I need ToList().
This is bit weird. But After trying all possible solutions, I noticed that NewtonSoft.JSON dll I was using was not of latest version.
I updated DLL through Nuget and Bingo! it starts working again.
Some suggestion for updating NewtonSoft.JSON dll
First uninstall old one and then update to latest one.
If you get FileLoadException for referring two NewtonSoft.JSON dll of different version then try this solution FileLoadException was unhandled by user code

dotnetrdf xml exception using QueryWithResultSet

I have an asp.net project in which, I would like to query DBPedia.
Using the following code I am getting an error:
public string testEndpoint()
{
//TEST02
SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri("http://dbpedia.org/sparql"), "http://dbpedia.org");
string res = "";
//Make a SELECT query against the Endpoint
SparqlResultSet results = endpoint.QueryWithResultSet("SELECT ?year WHERE {dbpedia:Rihanna dbpedia-owl:birthYear ?year}");
foreach (SparqlResult result in results)
{
res = result.ToString();
Console.WriteLine(result.ToString());}
Error message: "An exception of type 'System.Xml.XmlException' occurred in dotNetRDF.dll but was not handled in user code".
Even if I handle the exception the method cannot be executed. Regarding the details it says that there is an invalid XML-version 1.1.
As the XML comes from DBPedia I don't know how to change the xml version or how else I can handle this problem.
Virtuoso, which is the triple store used behind the dbpedia SPARQL endpoint, has updated its XML result generation. They replaced the XML version 1.0 with 1.1 in this commit. This causes the exception in the dotNetRDF parser.
Later on Virtuoso reverted the changes in the XML header. Hopefully DBPedia will update their binaries soon, so the old XML header appears again in the SPARQL results.
Source: http://github.com/openlink/virtuoso-opensource/issues/405

Infragistics ADOMD ClassCastException when connecting to ActivePivot's XMLA server

I am trying to edit the Infragistics WPF PivotGrid Sample so that it will connect to the ActivePivot Sandbox Server. ActivePivot supports XMLA and I can connect to the same Sandbox Server using the 'From Analysis Services' DataSource option in MS Excel with no issues. I edited the odc file to match the exact same connection string as below and it sill worked.
In the DataSourceAdomdNet.xaml file in the Infragistics.Samples.WPF project, I replaced the AdomdDataSource with the following:
<igOlap:AdomdDataSource x:Key="AdomdDataSource"
Database="Sandbox"
Cube="EquityDerivativesCube">
<igOlap:AdomdDataSource.ConnectionSettings>
<igOlap:AdomdConnectionSettings ConnectionString="Password=admin;Persist Security Info=True;User ID=admin;Initial Catalog=Sandbox;Provider=MSOLAP.4;Persist Security Info=True;Data Source=http://localhost:8080/xmla;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error" />
</igOlap:AdomdDataSource.ConnectionSettings>
</igOlap:AdomdDataSource>
When I run the Samples project and look at the PivotGrid, I see the following exception:
InnerException: System.InvalidCastException
HResult=-2147467262
Message=Object cannot be cast from DBNull to other types.
Source=mscorlib
StackTrace:
at System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider)
at System.Convert.ToDateTime(Object value, IFormatProvider provider)
at Microsoft.AnalysisServices.AdomdClient.CubeDef.get_LastProcessed()
at Infragistics.Olap.Adomd.AdomdDataProvider.LoadCubesWorkerDoWork(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
InnerException:
I am experienced with ActivePivot, but not so much with Infragistics/ADOMD.NET. I have never seen this type of error when using any other XMLA/ADOMD client with ActivePivot.
Can anyone help?
Thanks

Throw Exception when set OutlineCode1 value on Export Data to Microsoft Office Project

I developed a Windows Forms Application with C# and SQL Server, I wrote this code to set OutlineCode1 value :
using Microsoft.Office.Interop.MSProject;
...
task.OutlineCode1 = value.ToString();
when i set task.OutlineCode1 value, throw exception and i get this Error :
System.Runtime.InteropServices.COMException
"An unexpected error occurred with the method."
i tested all Microsoft Office Project interop version.
The OutlineCode1-10 fields are limited to values on the lookup list. First populate the list, then you can set the values.
You can do this from the user interface or at runtime:
CustomFieldValueListAdd pjCustomTaskOutlineCode1, value.ToString()
(add object qualifiers as necessary)

Categories

Resources