Using Microsoft.NET standard library types in Unity configuration file - assemblies

I am trying to register a type conversion in my config file as follows:
<param name="connectionString" parameterType="System.String">
<value value="MyDbConnection"
type="System.Configuration.ConnectionStringSettings"
typeConverter="ConnectionStringSettingsTypeConverter" />
</param>
I am getting the standard can't load type error
Could not load type 'System.Configuration.ConnectionStringSettings' from assembly 'Microsoft.Practices.Unity.Configuration, ...etc
Why is it trying to load the type from the Unity assembly? What do I need to add for Unity to locate the correct assembly?
I thought because I was using the fully qualified name, it should just work.
Edit: note I am using version 1.2. The 2.0 version has an tag in the schema, but 1.2 doesn't seem to have this tag.

You're not using the really fully qualified type name - you need to provide the assembly name as well. Try this:
type="System.Configuration.ConnectionStringSettings,System.Configuration"

Related

Missing Functoid in BizTalk 2013r2 Map

I've picked source code for an existing BizTalk 2013r2 solution that I'm trying to compile using Visual Studio 2013.
I'm hitting the following error when trying to compile a map:
Mapper Compiler: Functoid not found: guid
(2de6985a-3dff-46eb-a7d8-4fc884756860) with functoid id (54009). Check
if the assembly implementing this functoid is present
I've scanned all the source code I was provided with and there's no sign of any custom functoid classes. Maybe I'm missing a reference to an open source functoid library but from what I can see in the .btm file, there's not much to go on:
<Functoid FunctoidID="31" Functoid-FID="54009" X-Cell="44" Y-Cell="196" Functoid-CLSID="2de6985a-3dff-46eb-a7d8-4fc884756860">
<Input-Parameters>
<Parameter Type="constant" Value="ReceivedFileName" linkIndex="0" Guid="10eb4cb9-05b3-4e6e-b534-f3ee7ea8dadb" />
<Parameter Type="constant" Value="http://schemas.microsoft.com/BizTalk/2003/file-properties" linkIndex="1" Guid="e9119104-6fb3-43ef-9d17-ada0568dc557" />
</Input-Parameters>
Any ideas?
It sounds like you are missing a custom functoid. This is the reason I am not a fan of custom functoids. I prefer to put custom code in scripting functoids because it then goes with the map in source code.
That custom functoid does not appear in any of the searches, for example BizTalk Server: List of Custom Functoids (Technet). So I think you are on your own.
Look for a custom assembly in C:\Program Files (x86)\Microsoft BizTalk Server 2013 R2\Developer Tools\Mapper Extensions or as bts_dev says in the GAC.
Maps take reference from GACed assemblies, be it helper libraries or any other libraries. Custom functoids are also installed in GACed and then only can be added to tool boxes in Map editor.
Maybe on the source machine it was working as functoid assembly was deployed.
To resolve this issue, check the map project references and all referenced projects are building successfully.
There also may be a case of map assembly getting deployed when you tried to build the map project. But since it was deployed when VS solution was open it will not take reference to that deployed assembly yet. Try restarting the Visual Studio and open the solution again and then build the map project.

UWP app errors when built in .Net Native

We've got a Windows 8.1 app that we've converted to a Windows 10 UWP app. The app works fine in debug, but when running in Release (.Net Native), we are getting a runtime error on app load. It's not at all clear what's causing the error. The error happens in the OnLaunched event in App.xaml.cs where some data is being initialized. The error:
An exception of type System.NullReferenceException occurred in
System.Private.CoreLib.dll
Additional information: Arg_NullReferenceException
We're using the latest versions of MVVM Light.
I know this isn't a lot of info, but it's really all we have right now and are pretty stumped. Anyone seen and issue like this or know where to start in tracking it down?
If, you're still using SQLite or any Reference.
Please Right Click to your Project => Add => Reference => Make sure your DLL of Nuget is checked.
Please Check this solution.
I had this exact problem in that I converted an 8.1 app to UWP. This was resolved by including a file called Default.rd.xml in the Properties folder. This was not mentioned in the migration guide that I had used.
Not including it means some pretty common coding patterns such as reflection will not work, and this includes in imported .dll's.
A basic Default.rd.xml file looks like the following ...
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>
If this does not work, then try creating a new empty UWP project to get the latest format for the file.

Added the missing reference to the project, but types are still not recognized. Why?

I am trying to create a simple code sample that access an oracle database, in a Web Api 2 project.
Since OracleClient dll is not available "by default" (if I understand it right, upon creating a new project the targeting framework subset is not the full framework dll set), I added a reference to System.Data.OracleClient.
The references to the dll's types such as OracleConnection, OracleCommand and so are all recognized by VS, just like intelisense shows OracleClient after typing System.Data.
A build however raises an error stating
The type or namespace name 'OracleClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
The runtime version (v4.0.30319) and version (4.0.0.0) are exactly the same as, say, System.Data, automatically loaded when upon creation.
What is wrong ?
Adding a reference to a new dll requires restarting visual studio.

Purpose of Runtime section in Web.config

When closely observing Web.config, all the possible child elements of <configuration> are also present inside configuration/runtime.
I have never encountered a need to specify values in configuration/runtime section. Have you come across this situation?
What is the purpose of specifying values in runtime section ?
The purpose of <configuration><Runtime> settings as described in msdn here
is
"Runtime settings specify how the common language runtime handles
garbage collection and the version of an assembly to use in
configuration files."
These are CLR settings that you can configure for your application. The possible settings directly under <configuration> is the not the same as <configuration><Runtime>. You can refer to the <configuration> schema here
To add to above reply i did face real time situation to use
"runtime" element for configuring Assembly binding.
I was using Ninject which was referring to System.Web.MVC 3.0.0.0 while i was having System.Web.MVC with version 5.0.0.0
This was causing IOFileNotFound exception
By Adding "runtime" binding i could redirect any binding for System.Web.MVC to 5.0.0.0 verison.

Accessing LinqBridge from JSON.NET dll

I am using JSON.NET which has the LinqBridge .dll merged in. LinqBridge allows Linq to be accessed from .NET 2. If I try to use Linq, even after importing System.Linq, I receive the following error:
Error 13 Could not find an implementation of the query pattern for source type 'int[]'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'? C:\Users\chrisl\Desktop\SoftTokens\Windows Desktop Soft-Token\Program.cs 27 25 WindowsSoftToken
If I try to include LinqBridge, then because JSON.NET already includes it, I receive this warning. Additionally, I have included the same component twice, which is inefficient:
Warning 2 The predefined type 'System.Action' is defined in multiple assemblies in the global alias; using definition from 'c:\Users\chrisl\Desktop\SoftTokens\Windows Desktop Soft-Token\libs\Newtonsoft.Json.Net20.dll' WindowsSoftToken
If I browse Newtonsoft.Json.Net20 in the object browser, I see that System.Linq appears empty, even after I have slected Show hidden types and methods.
Is it possible to access Linq from the JSON.NET dll or to suppress the error messages?
The Enumerable static class that provides the LINQ query operators in the LINQBridge assembly is still exposed in the System.Linq namespace.
You still need to have the using directive for System.Linq as directed in your first error message.
Update:
It turns out the LINQBridge assembly that's merged into Newtonsoft.Json.Net20.dll has been "internalized" which I hadn't noticed at first. This means your code can't reference the Enumerable type that the compiler needs to "implement the query pattern." So you do have to reference the LINQBridge assembly yourself, but then you get the warning about duplicate definitions as you mentioned.
You can disable the duplicate class warning by going to the Build tab of your project properties and enter "1685" in the "Suppress warnings:" box.
But what would probably be better would be to build your own version of JSON.net from source without merging in LINQBridge.

Resources