Deploying Entity Framework WPF Application - c#
I've made a WPF application that uses EF6 code first database.
I've been doing it all in Visual Studio and using the default LocalDb.
The client wants to test what i've doe so far. I've tried ClickOnce application installation to my development PC. The program simply doesn't start, no window opens.... absolutely nothing happens.
I've deployed a simple WPF app and it works right away so i surmise it's the EF component.
How do i get some sort of output log, or debugging so i can see what the error is?
Any ideas on how to fix the error?
Where does it get installed to?
How can i attach the debugger?
MY CONNECTION DETAILS from App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="EEHA_Inspector.Properties.Settings.EEHA_Inspector_Model_EEHA_DbContextConnectionString"
connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=EEHA_Inspector.Model.EEHA_DbContext;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Any help would be greatly appreciated.
UPDATE #2 - Windows Log Exception
Application: EEHA_Inspector.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Data.SqlClient.SqlException
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(System.Data.Common.DbConnection, UInt32, Boolean, Boolean, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>)
at System.Data.SqlClient.SqlConnection.TryOpen(System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbConnectionInterceptionContext)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Dispatch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon, System.Action`2<System.__Canon,System.__Canon>, System.__Canon, System.Action`3<System.__Canon,System.__Canon,System.__Canon>, System.Action`3<System.__Canon,System.__Canon,System.__Canon>)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext)
at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy+<>c__DisplayClass1.<Execute>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<System.__Canon>)
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(System.Action)
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
Exception Info: System.Data.Entity.Core.EntityException
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<System.__Canon>, System.Data.Entity.Infrastructure.IDbExecutionStrategy, Boolean, Boolean)
at System.Data.Entity.Core.Objects.ObjectQuery`1+<>c__DisplayClass7[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<System.__Canon>)
at System.Data.Entity.Core.Objects.ObjectQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResults(System.Nullable`1<System.Data.Entity.Core.Objects.MergeOption>)
at System.Data.Entity.Core.Objects.ObjectQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Linq.Enumerable.FirstOrDefault[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>, System.Linq.Expressions.Expression)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.Expressions.Expression)
at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.Expressions.Expression)
at System.Linq.Queryable.FirstOrDefault[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.IQueryable`1<System.__Canon>)
at System.Data.Entity.Internal.EdmMetadataRepository.QueryForModelHash(System.Func`2<System.Data.Common.DbConnection,System.Data.Entity.Internal.EdmMetadataContext>)
at System.Data.Entity.Internal.InternalContext.QueryForModelHash()
at System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(System.Data.Entity.Internal.InternalContext, System.Data.Entity.Internal.ModelHashCalculator, Boolean, System.Data.Entity.Internal.DatabaseExistenceState)
at System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean, System.Data.Entity.Internal.DatabaseExistenceState)
at System.Data.Entity.CreateDatabaseIfNotExists`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InitializeDatabase(System.__Canon)
at System.Data.Entity.Internal.InternalContext+<>c__DisplayClassf`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<CreateInitializationAction>b__e()
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(System.Action)
Exception Info: System.Data.DataException
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(System.Action)
at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(System.Data.Entity.Internal.InternalContext)
at System.Data.Entity.Internal.RetryAction`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].PerformAction(System.__Canon)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(System.Action`1<System.Data.Entity.Internal.InternalContext>)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(System.Type)
at System.Data.Entity.Internal.Linq.InternalSet`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Where[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.IQueryable`1<System.__Canon>, System.Linq.Expressions.Expression`1<System.Func`2<System.__Canon,Boolean>>)
at EEHA_Inspector.Model.LoadObvCollection+<Equips>d__4.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at EEHA_Inspector.ViewModel.EquipRegVm+<Load>d__55.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at EEHA_Inspector.App.Main()
UPDATE #2 - Windows Log Information
Fault bucket 129273820369, type 5
Event Name: CLR20r3
Response: Not available
Cab Id: 0
Problem signature:
P1: EEHA_Inspector.exe
P2: 1.0.0.0
P3: 58222f01
P4: System.Data
P5: 4.6.1586.0
P6: 575a1428
P7: 29fe
P8: 108
P9: System.Data.DataException
P10:
Attached files:
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERCB7E.tmp.WERInternalMetadata.xml
These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_EEHA_Inspector.e_11252b12b7f6697437e3ba42fb9b6e25caa6b8_5e1d3f42_3a80d3bb
Analysis symbol:
Rechecking for solution: 0
Report Id: 91f3e855-2996-40fe-b5fd-957527bbdc9d
Report Status: 0
Hashed bucket: f5ea3fa3886ba4e09d8362936de86fe8
UPDATE #2 -Application Error in Windows Log
Faulting application name: EEHA_Inspector.exe, version: 1.0.0.0, time stamp: 0x58222f01
Faulting module name: KERNELBASE.dll, version: 10.0.14393.0, time stamp: 0x57898e34
Exception code: 0xe0434352
Fault offset: 0x000d96c2
Faulting process id: 0x5458
Faulting application start time: 0x01d239ffc4803847
Faulting application path: C:\Users\agibson\AppData\Local\Apps\2.0\1RVHJ9WW.8JB\BDB4M51Q.L3R\eeha..tion_fe2d9ab6a328f11f_0001.0000_19df975805717e2b\EEHA_Inspector.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 91f3e855-2996-40fe-b5fd-957527bbdc9d
Faulting package full name:
Faulting package-relative application ID:
UPDATE 3 ===================================================
OnModelOveride in the DbContext
namespace EEHA_Inspector.Model
{
/// <summary>
/// Database Definition.
/// </summary>
public class EEHA_DbContext : DbContext
{
...............
/// <summary>
/// Fluent API - Entity Building Configuration. Used to define extra conditions when building the model.
/// These are more powerful than data annotations but also more complex.
/// </summary>
/// <param name="modelBuilder"></param>
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
/* FLUENT API MODEL OVERIDE - INTERMEDIARY TABLES
* Creates an intermediate mapping tables to hold many-to-many relationships between
* two tables. This is since one table can have multiple objects from another table.
* This intermediate table is used just as a look up table.
* Although its a look up table, databases must be configured to show the link two ways
* since its not possible to have a many-to-many unidirectional relationship.
* By mapping these intermediary table; the lookup table stays clear of the relationship;
* while this intermediary table handles the needed mapping to make it possible.
* E.g. An Equip object contains a collection of Protections; while a Protection
* does not contain any reference to an Equip; since this is handled in a 3rd mapping table,
* created by these Fluent API model builder commands. */
// Equipment Many-To-Many Look Up to ProtectionCodes
modelBuilder.Entity<Equip>()
.HasMany(e => e.Protections)
.WithMany()
.Map(x =>
{
x.MapLeftKey("EquipId");
x.MapRightKey("ProtectionId");
x.ToTable("EquipMapToProtections");
});
// InspectCheck Many-To-Many Look Up to InspectGrades
modelBuilder.Entity<InspectCheck>()
.HasMany(i => i.InspectGrades)
.WithMany()
.Map(x =>
{
x.MapLeftKey("InspectCheckId");
x.MapRightKey("InspectGradeId");
x.ToTable("InspectCheckMapToInspectGrades");
});
}
}
}
UPDATE 3.1
Initialiser Setup
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
// Set the database initializer
Database.SetInitializer<EEHA_DbContext>(new EEHA_DbInit());
}
}
SEED OVERIDE
#if DEBUG
#define DESTROY_DB_ONSTART //TODO remove when development progresses. Will make the database get dropped upon every start up
#endif
namespace EEHA_Inspector.Model
{
/// <summary>
/// Custom Initialiser for the HA Database.
/// Set the initialiliser in the App.xaml.cs class contructor (make one if not there).
/// <code>Database.SetInitializer<EEHA_DbContext>(new EEHA_DbInit());</code>
/// </summary>
#if DESTROY_DB_ONSTART
class EEHA_DbInit : DropCreateDatabaseAlways<EEHA_DbContext>
#else
class EEHA_DbInit : CreateDatabaseIfNotExists<EEHA_DbContext>
#endif
{
#if DESTROY_DB_ONSTART
/// <summary>
/// Overide the Initialize to force a close of all connections when in testing
/// </summary>
/// <param name="Db">The DbContext to operate on.</param>
public override void InitializeDatabase(EEHA_DbContext Db)
{
#if DEBUG
this.KillAllConnections(Db);
#endif
base.InitializeDatabase(Db);
}
#endif
protected override void Seed(EEHA_DbContext Db)
{
.....changes to Db
Db.SaveChanges();
base.Seed(Db);
Db.SaveChanges(); //TODO needed?
}
UPDATE 4 - Using DbConfig
Earlier today i ran the SQLExpress install manually and just went with the defaults for all options.
I've converted to DbConfig based on what i could find on the msdn update. This works again in visual studio. Making the Db at the name i gave to the DbContext Constructor.
Just to be sure i uninstalled the programs ClickOnce install. Reinstalled. When i was fiddling earlier i noticed this, but i now get a dialog box saying "Cannot Start Application || Application cannot be started. Contact the application Vendor". Unlike earlier where the app would run and then crash. This new way gives me no custom exception log, but i do get details shown below:
Cannot Start Application Error - Details button .log
PLATFORM VERSION INFO
Windows : 10.0.14393.0 (Win32NT)
Common Language Runtime : 4.0.30319.42000
System.Deployment.dll : 4.6.1586.0 built by: NETFXREL2
clr.dll : 4.6.1586.0 built by: NETFXREL2
dfdll.dll : 4.6.1586.0 built by: NETFXREL2
dfshim.dll : 10.0.14393.0 (rs1_release.160715-1616)
SOURCES
Deployment url : file:///C:/TempPath/EEHA/EEHA_Inspector.application
IDENTITIES
Deployment Identity : EEHA_Inspector.application, Version=1.0.0.17, Culture=neutral, PublicKeyToken=fe2d9ab6a328f11f, processorArchitecture=msil
APPLICATION SUMMARY
* Installable application.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\TempPath\EEHA\EEHA_Inspector.application resulted in exception. Following failure messages were detected:
+ External component has thrown an exception.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [9/11/2016 8:03:58 PM] : Activation of C:\TempPath\EEHA\EEHA_Inspector.application has started.
* [9/11/2016 8:03:58 PM] : Processing of deployment manifest has successfully completed.
ERROR DETAILS
Following errors were detected during this operation.
* [9/11/2016 8:03:58 PM] System.Runtime.InteropServices.SEHException
- External component has thrown an exception.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Internal.Isolation.IStateManager.Scavenge(UInt32 Flags, UInt32& Disposition)
at System.Deployment.Application.ComponentStore.SubmitStoreTransaction(StoreTransactionContext storeTxn, SubscriptionState subState)
at System.Deployment.Application.ComponentStore.SetPendingDeployment(SubscriptionState subState, DefinitionIdentity deployId, DateTime checkTime)
at System.Deployment.Application.SubscriptionStore.SetLastCheckTimeToNow(SubscriptionState subState)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
COMPONENT STORE TRANSACTION DETAILS
* Transaction at [9/11/2016 8:03:58 PM]
+ System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata
- Status: Set
- HRESULT: 0x0
+ System.Deployment.Internal.Isolation.StoreTransactionOperationType (27)
- HRESULT: 0x0
Db Context Constructor
public EEHA_DbContext() : base("TestEEHACodeDb")
{
}
The DbConfig Class
namespace EEHA_Inspector.Model
{
public class EEHA_DbConfig : DbConfiguration
{
public EEHA_DbConfig()
{
SetExecutionStrategy("System.Data.SqlClient", () => new SqlAzureExecutionStrategy());
SetDefaultConnectionFactory(new LocalDbConnectionFactory("v11.0"));
}
}
}
App.config Removed connection string. Do i remove more?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<!--<connectionStrings>
<add name="EEHA_Inspector.Properties.Settings.EEHA_Inspector_Model_EEHA_DbContextConnectionString"
connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=EEHA_Inspector.Model.EEHA_DbContext;Integrated Security=True"
providerName="System.Data.SqlClient" />
--><!--<add name="EEHA_Inspector.Properties.Settings.EEHA_Inspector_Model_EEHA_DbContextConnectionString"
connectionString="Data Source=./SQLEXPRESS;Initial Catalog=EEHA_Inspector.Model.EEHA_DbContext;Integrated Security=True"
providerName="System.Data.SqlClient" />--><!--
</connectionStrings>-->
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<!--<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">-->
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
SOLUTION/ / WRAP UP
Thanks to grek40. Particularly his exception catching code. This allowed me to start making changes to find the errors. Prior to that, the windows logs didn't help at all.
What put me past the hurdle was using the DbContext definition he suggested. For some reason using the default DbContext constructor and a connection string seemed to make ClickOnce install expect to find an mdf file; even though attaching one wasn't specified.
The exception catch code also allowed my my debugging in release mode to find some odd exceptions (once that didn't apply to debug mode, or that made any sense to me). I've now turned off the offending code so i could proceed; the click once install now works.
I want to make sure that you actually do everything possible to catch and log the occuring exception.
Make sure to register an exception handler in App.xaml with DispatcherUnhandledException
<Application
x:Class="[Your Stuff]"
DispatcherUnhandledException="Application_DispatcherUnhandledException">
</Application>
Implement some logging in the handler (inside App.xaml.cs). It should be something that summarizes the exception messages of all inner exceptions as well as their stack traces. Just write that information to some sort of log file (C:\Temp\MyAppCrashes.log in my example).
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
var sb = new StringBuilder();
AppendExceptionMessages(sb, e.Exception);
AppendExceptionStacktraces(sb, e.Exception);
File.AppendAllText(#"C:\Temp\MyAppCrashes.log", sb.ToString());
}
private void AppendExceptionMessages(StringBuilder sb, Exception e)
{
while (e != null)
{
sb.AppendLine("============== Exception ===============").AppendLine(e.Message);
e = e.InnerException;
}
}
private void AppendExceptionStacktraces(StringBuilder sb, Exception e)
{
while (e != null)
{
sb.AppendLine("======== Exception Stacktrace ==========").AppendLine(e.StackTrace);
e = e.InnerException;
}
}
I hope this reveals some more information, if it's not enough, make sure to register a Startup handler in App.xaml instead of a StartupUri. In the startup, before creating any window, create an instance of your db context, call db.Database.Exists() and db.Database.Initialize(true), make sure to check the Exists return value and wrap the calls in try-catch. Ofcourse, write logging details if any exception is caught.
So far for now, hope you find anything with that approach.
Related
Enterprise Library Logging - Visual Studio - MONO - MacOSX - NotImplementedException
I'm trying new VisualStudio for Mac (Mono 6.0.0.296) with With Microsoft Enterprise Library 6.0.1304. Unfortunatly im not able to use it since an "NotImplementedException" is raised. I have been using Enterprise Library for many years but in Visual Studio (Windows Env.) and it is great but when i tried to use the same under mono everything seems not working. After some search i can see that mscorlib.dll for MONO dows not support WindowsIdentity "User" Property. mscorlib.dll (4.0.0.0 - MONO) using System.Runtime.InteropServices; [MonoTODO ("not implemented")] [ComVisible (false)] public SecurityIdentifier User { get { throw new NotImplementedException (); } } Application: public static void Main (string [] args) { LogWriter logWriter = new LogWriterFactory ().Create (); Logger.SetLogWriter (logWriter, false); logWriter.Write ("Application is working", "General", 5, 2000, TraceEventType.Information); } App.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" /> </configSections> <loggingConfiguration name="" tracingEnabled="false" defaultCategory="General" logWarningsWhenNoCategoriesMatch="false"> <listeners> <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="RollingFlatFile.log" footer="----------------------------------" formatter="Text Formatter" header="" rollInterval="Day" traceOutputOptions="DateTime, Timestamp" filter="All" /> </listeners> <formatters> <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Timestamp: {timestamp(local)}{newline} Message: {message}{newline} Category: {category}{newline} Priority: {priority}{newline} Severity: {severity}" name="Text Formatter" /> </formatters> <categorySources> <add switchValue="All" autoFlush="true" name="General"> <listeners> <add name="Rolling Flat File Trace Listener" /> </listeners> </add> </categorySources> <specialSources> <allEvents switchValue="All" name="All Events"> <listeners> <add name="Rolling Flat File Trace Listener" /> </listeners> </allEvents> <notProcessed switchValue="All" name="Unprocessed Category"> <listeners> <add name="Rolling Flat File Trace Listener" /> </listeners> </notProcessed> <errors switchValue="All" name="Logging Errors & Warnings"> <listeners> <add name="Rolling Flat File Trace Listener" /> </listeners> </errors> </specialSources> </loggingConfiguration> </configuration> Error tracked into the file: Timestamp: 12/07/2019 16:36:11 Message: Processing of the message failed. See summary information below for more information. Should this problem persist, stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks. Summary for Enterprise Library Distributor Service: --> Message: Timestamp: 12/07/2019 14:36:11 Message: Application is working Category: General Priority: 5 EventId: 2000 Severity: Information Title: Machine: MacBook-Pro-di-John App Domain: F.B.Library.exe ProcessId: Unable to read intrinsic property. Error message: GetCurrentProcessId Process Name: Unable to read intrinsic property. Error message: GetModuleHandle Thread Name: Win32 ThreadId:Unable to read intrinsic property. Error message: GetCurrentThreadId Extended Properties: --> MachineName: MacBook-Pro-di-John --> TimeStamp: 12/07/2019 14:36:11 --> FullName: Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 --> AppDomainName: F.B.Library.exe --> WindowsIdentity: jfk Exception Information Details: Exception Type: System.NotImplementedException Message: The method or operation is not implemented. Data: System.Collections.ListDictionaryInternal TargetSite: System.Security.Principal.WindowsIdentity GetCurrent(Boolean) HelpLink: NULL Source: mscorlib HResult: -2147467263 StackTrace Information Details: at System.Security.Principal.WindowsIdentity.GetCurrent (System.Boolean ifImpersonating) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs:165 at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.RevertExistingImpersonation () [0x0000f] in :0 at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog (Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry log, System.Diagnostics.TraceEventCache traceEventCache) [0x00000] in :0 at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter+<>c__DisplayClass13.b__12 () [0x0007f] in :0 From The log, you can clearly see that System.Security.Principal.WindowsIdentity.GetCurrent breaks the rule... Could you Kindly help me on this? Did anyone try to use Enterprise Library with Mono on MacOS? Is somewhere present a workaround? Thanks a lot for your help and time. Regards,
finally i have managed such situation. First of all, thanks to all comments, those helped me lot of with resolution. Basically, i had to change a part of MEL 6 code and then i could use it without issue. As previously suggested by #SushiHangover, i took MEL 6 source code and i started to analyze... i have fould a part of the code that was calling SecurityIdentifier User inside mscorlib.dll What i did is: - download MEL 6 source code - open it with Visual Studio for MAC - delete all Test projects and files not supported by the engine - compile till everything is fine Once you have your prj compiled, find and comment "Impersonation" section of the below section: private void ProcessLog(LogEntry log, TraceEventCache traceEventCache) { // revert any outstanding impersonation //using (RevertExistingImpersonation()) //{ var items = new ContextItems(); items.ProcessContextItems(log); var matchingTraceSources = GetMatchingTraceSources(log); var traceListenerFilter = new TraceListenerFilter(); foreach (LogSource traceSource in matchingTraceSources) { traceSource.TraceData(log.Severity, log.EventId, log, traceListenerFilter, traceEventCache, ReportExceptionDuringTracing); } //} } Code Sample Image Link After that, recompile, use compiled dll into your own project and it will finally work. If you have any further question or dubt, please let me know and i will be happy to reply. Have a great working day, Regards, Florin
Occasional error: The type 'HttpRequestMessage' is defined in an assembly that is not referenced
I am working on an old WebForms project. Occasionally it won't build The type 'HttpRequestMessage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The exception above is thrown on Request on this line public class MyController : ApiController { [System.Web.Http.HttpPost] public string Test() { string data = Request.Content.ReadAsStringAsync().Result; } } To be able to run the website, I simply have to Rebuild Solution (without changing anything at all). Any idea what may be causing it?
Add below code in you web.config <configuration> <system.web> <compilation> <assemblies> <add assembly="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </assemblies> </compilation> </system.web> </configuration>
Getting a strange exception with the MS Exception Handling Block
I've created a very basic Logging block and Exception Handling block. In my code, I went to go test the Exception Handling (I know the Logging block works) with the following: public void RunScriptClean() { try { throw new FileNotFoundException(); } catch (FileNotFoundException ex) { var b = ExceptionPolicy.HandleException(ex, "Logging Policy"); if (b) throw; } } However, on the very first line of the catch block, I get this long winded exception and my application crashes: Exception occured: The current build operating (build key Build Key [Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, Logging Policy]) failed: The type 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' cannot be resolved. Please verify the spelling is correct or that the full type name is provided. (Strategy type ConfiguredObjectStrategy, index 2). I have absolutely no idea what it's referring to when it says the type cannot be resolved. I've added references to Microsoft.Practices.EnterpriseLibrary.Common/ExceptionHandling/Logging and Ms.Practices.ObjectBuilder2. This one class has using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling included at the top. Added a screenshot of the configuration tool looking at my AppConfig file: I'm sure I'm missing something basic, but it's tough to find a tutorial for EAB 4.1-- CodeProject has a lot for the original versions but I couldn't make much of them... Edit I tried creating a new Formatter and naming it TextExceptionFormatter but that didn't change anything. Wasn't sure if maybe some how the FormatterType property on my Logging Handler was tied to that node. And the actual block of XML from App.config: <exceptionHandling> <exceptionPolicies> <add name="Logging Policy"> <exceptionTypes> <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception"> <exceptionHandlers> <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="0" useDefaultLogger="false" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Logging Handler" /> </exceptionHandlers> </add> </exceptionTypes> </add> </exceptionPolicies> </exceptionHandling> I found this SO question: Cannot resolve type runtime error after registering the Enterprise Library into the GAC but even after changing the Version segment of the fullName attribute my app still behaves the same.
Alright, I was able to find a sample application that used the Logging handlers. Turns out I needed a reference to ExceptionHandling.Logging: Microsoft.Practices.EnterpriseLibrary.Common Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging **** Microsoft.Practices.EnterpriseLibrary.Logging Microsoft.Practices.ObjectBuilder2 Where as I only had a references to: Microsoft.Practices.EnterpriseLibrary.Common Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Microsoft.Practices.EnterpriseLibrary.Logging Microsoft.Practices.ObjectBuilder2
"An error occurred creating the configuration section handler for" -
We're getting an odd error in our Test environment with a custom configuration section. This is for a Windows Service running on a Enterprise Server 2008 r2 64 bit with SQL Server 2008 in both dev and test environments. This section configures our shared code library to send email out to interested parties whenever an error is handled and published with code like this: catch(Exception ex) { ExceptionManager.Publish(ex); } The error specifics (full detail - names changed to preserve the innocent) 4 <configSections> 5 <section name="exceptionManagement" 6 type="Company.Shared.ExceptionManagement.ExceptionManagerSectionHandler, Company.Shared" /> 7 </configSections> 8 <exceptionManagement> 9 <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.DefaultPublisher" 10 logName="CPODSOracleDataExchange" applicationName="CPODSOracleDataExchange Service" /> 11 <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.ExceptionManagerSMTPPublisher" 12 from="CPODSOracleDataExchangeService#Company.com" 13 defaultRecipients="dev1#Company.com,dev2#Company.com" 14 applicationName="CPODSOracleDataExchange Service" /> 15 </exceptionManagement> 1) Exception Information ********************************************* Exception Type: System.Configuration.ConfigurationErrorsException Message: An error occurred creating the configuration section handler for exceptionManagement: Request failed. (E:\CITApps\Services\CPODS.OracleDataExchangeService\Company.CPODS.OracleDataExchangeService.exe.Config line 5) BareMessage: An error occurred creating the configuration section handler for exceptionManagement: Request failed. Filename: E:\CITApps\Services\CPODS.OracleDataExchangeService\Company.CPODS.OracleDataExchangeService.exe.Config Line: 5 Errors: System.Configuration.ConfigurationException[] Data: System.Collections.ListDictionaryInternal TargetSite: System.Configuration.FactoryRecord FindAndEnsureFactoryRecord(System.String, Boolean ByRef) HelpLink: NULL Source: System.Configuration StackTrace Information ********************************************* at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at Company.Shared.ExceptionManagement.ExceptionManager.Publish(Exception exception, NameValueCollection additionalInfo) 2) Exception Information ********************************************* Exception Type: System.Security.SecurityException Action: Demand PermissionType: System.Security.PermissionSet FirstPermissionThatFailed: NULL PermissionState: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/> Demanded: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/> GrantedSet: RefusedSet: DenySetInstance: NULL PermitOnlySetInstance: <PermissionSet class="System.Security.PermissionSet" version="1"> <IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Access="Open"/> <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Allowed="ApplicationIsolationByUser" UserQuota="1024000"/> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Execution"/> <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Window="SafeTopLevelWindows" Clipboard="OwnClipboard"/> <IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" version="1" Level="SafePrinting"/> <IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" version="1" Audio="SafeAudio" Video="SafeVideo" Image="SafeImage"/> <IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" version="1" Level="Safe"/> </PermissionSet> FailedAssemblyInfo: NULL Method: Void InitWithRestrictedPermissions(System.Configuration.RuntimeConfigurationRecord, System.Configuration.FactoryRecord) Zone: NoZone Url: Message: Request failed. Data: System.Collections.ListDictionaryInternal TargetSite: System.Object CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef) HelpLink: NULL Source: mscorlib StackTrace Information ********************************************* at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(Type type) at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord) at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) The configuration file section in question (with line numbers): 4 <configSections> 5 <section name="exceptionManagement" 6 type="Company.Shared.ExceptionManagement.ExceptionManagerSectionHandler, Company.Shared" /> 7 </configSections> 8 <exceptionManagement> 9 <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.DefaultPublisher" 10 logName="CPODSOracleDataExchange" applicationName="CPODSOracleDataExchange Service" /> 11 <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.ExceptionManagerSMTPPublisher" 12 from="CPODSOracleDataExchangeService#Company.com" 13 defaultRecipients="dev1#Company.com,dev2#Company.com" 14 applicationName="CPODSOracleDataExchange Service" /> 15 </exceptionManagement> This exact same configuration works fine in our DEV environment. These are identical environments to the best of my knowledge, and both services are running under the same code base. Any ideas as to what the permissions failure is? One thing we are working on doing is creating the custom log but even when we remove the default publisher which tries to write to a custom log that doesn't exist, the process still fails.
Turns out this was an obscure installation issue. We uninstalled the service with the old exe, and reinstalled using 64 bit 4.0 framework and the issue went away.
Its the framework setting in the build configuration
Not directly related to your scenario, but if you get the same exception whilst attempting to run a .NET 4.0 app from a network share, then you need to install this hotfix: http://support.microsoft.com/kb/2580188
Using a profile property of type List in .NET Membership
I'm working on a C# Webservice that needs to provide authentication as well as roles and profile management. I need each profile to have a property of type List. The profile section in the web.config looks like this: <profile defaultProvider="MyProfileProvider" enabled="true"> <providers> <remove name="MyProfileProvider"/> <add connectionStringName="MySqlServer" applicationName="MyApp" name="MyProfileProvider" type="System.Web.Profile.SqlProfileProvider" /> </providers> <properties> <add name="Websites" type="System.Collections.Generic.List<String>" serializeAs="Binary"/> </properties> </profile> However, when I start the webservice and try to access that property it returns the following error: System.Configuration.ConfigurationErrorsException: Attempting to load this property's type resulted in the following error: Could not load type 'System.Collections.Generic.List<String>'. (C:\Projects\MyProject\web.config line 58) ---> System.Web.HttpException: Could not load type 'System.Collections.Generic.List<String>'. Is there a way to use a generic collection for this purpose?
After more searching I finally managed to find the answer. The solution is to use the type name qualified by its namespace. This means that for my issue I used: <add name="Websites" type="System.Collections.Generic.List`1[System.String]" serializeAs="Binary"/> I also found out that it is also possible to specify classes defined in other assemblies. To use those you need the assembly-qualified name. For example, that would be "System.Collections.Generic.HashSet`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" for a Hashset of Strings.