简体   繁体   中英

How to diagnose DataSource.Error when connecting to a custom ADO.NET provider?

I have been working on an own implementation of ADO.NET. It works quite well from Visual Studio, etc. but now I want to use it in Power BI Desktop.

I have registered the provider in the machine.config already (both platforms) and have copied all relevant assemblies into the GAC. Now I was finally able to go around the first few error messages Power BI gave me, but now I am stuck at this one:

DataSource.Error: An error happened while reading data from the provider: 'Value cannot be null.
Parameter name: values'
Details: DataSourceKind=AdoDotNet DataSourcePath=MyOwnProvider/param1=Something

Now it seems to me this is a standard .NET error message, so that would be easy to solve if I knew where it went wrong. Unfortunately I have found no way to diagnose the issue yet. I have tried using Visual Studio to debug Power BI (which seems to have successfully loaded my assembly). I have tried to use DebugView and ProcMon to see what happens, but all failed to give me anything useful.

How to diagnose what actually went wrong? How to get a detailed log, call stack, or whatever?

From the question on the Power BI forum I posted next to my question here I got quite a helpful answer. I also have some personal observations I want to share.

First, from Lydia on the forum:

... you can go to File -> Options and settings -> Options -> Diagnostics and click "enable tracing", then connect to your data source and check the detailed logs in the traces folder

This was very helpful since Power BI uses a separate process to kick off the data fetching. These processes, Microsoft.Mashup.Container.NetFX40.exe and Microsoft.Mashup.Container.NetFX45.exe actually make the connection to the ADO.NET data sources. If you have your provider running, you can also attach to them in order to trace the execution.

Another thing I found helpful was using a separate file to write the tracing in. I have used an event handler to AppDomain.UnhandledException to write to a trace file. This also gave me some bugs in the Power BI code, which was very helpful to diagnose what went wrong beyond my own provider.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM