You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Assembly.GetEntryAssembly can be null and causes crashes. #27
There are two calls to Assembly.GetEntryAssembly - do you know which one you are having problems with?
The first is MeasurementConfiguration - this is easily avoided by instead using the constructor that takes application name and version rather than trying to automatically get it from the app assembly.
The second is in AppDataContractSerializer which is used by the AutoMeasurement code to automatically handle serialization to the correct folder. AutoMeasurement is designed for regular managed Windows Store, Windows Phone or WinForms/WPF scenarios.
It might help to understand why you are accessing CSharpAnalytics through native code and what you are trying to achieve. While I'm sure most of the pieces can be reused it's not an out-of-the-box scenario. One option would eb to change the AppDataContractSerializer to take the company name as an argument and either have that provided through the configuration mechanism.
My scenario is an outlook plugin, which is essentially a c# windows form that gets hosted in Outlook. Other then the issue I mentioned (and the few I'm sure I haven't found yet) it works like a charm.
For Assembly.GetEntryAssembly, we're in complete agreement :)
I worked around MeasurementConfiguration in my code, but for AppDataContractSerializer I just hacked the source to hard code a value - let me pass in a value as you find most appropriate.
Actually adding it to MeasurementConfiguration and plubming it through was a bit of a pain. Instead you can just set AppDataContractSerializer.FolderPath before using AutoMeasurement to avoid it guessing where to store the config file using Reflection. Let me know if that works for you.
Activity
damieng commentedon Dec 11, 2014
There are two calls to Assembly.GetEntryAssembly - do you know which one you are having problems with?
The first is MeasurementConfiguration - this is easily avoided by instead using the constructor that takes application name and version rather than trying to automatically get it from the app assembly.
The second is in AppDataContractSerializer which is used by the AutoMeasurement code to automatically handle serialization to the correct folder. AutoMeasurement is designed for regular managed Windows Store, Windows Phone or WinForms/WPF scenarios.
It might help to understand why you are accessing CSharpAnalytics through native code and what you are trying to achieve. While I'm sure most of the pieces can be reused it's not an out-of-the-box scenario. One option would eb to change the AppDataContractSerializer to take the company name as an argument and either have that provided through the configuration mechanism.
idvorkin commentedon Dec 11, 2014
My scenario is an outlook plugin, which is essentially a c# windows form that gets hosted in Outlook. Other then the issue I mentioned (and the few I'm sure I haven't found yet) it works like a charm.
For Assembly.GetEntryAssembly, we're in complete agreement :)
I worked around MeasurementConfiguration in my code, but for AppDataContractSerializer I just hacked the source to hard code a value - let me pass in a value as you find most appropriate.
damieng commentedon Dec 12, 2014
Actually adding it to MeasurementConfiguration and plubming it through was a bit of a pain. Instead you can just set AppDataContractSerializer.FolderPath before using AutoMeasurement to avoid it guessing where to store the config file using Reflection. Let me know if that works for you.