I'm a little lost on the examples at http://autofac.readthedocs.org/en/latest/configuration/xml.html#configuring-with-microsoft-configuration
After poking around for ages not realising I also had to add the Microsoft.Extensions.Configuration.Json package (and they were only in pre-release), I now get an error on:
var module = new ConfigurationModule(config.Build());
I get a compile error about not being able to instantiate an abstract class.
There's no mention in the docs about having to ref any other package. Any ideas?
Right, so what I had to do was instal the pre release version which solved my issues
I was using the current stable.
As Stephen noted, the documentation covers the prerelease API by default. You can access documentation for the currently supported XML configuration process by toggling the green v:Latest in the bottom left corner of the docs, which will give you the option of switching to the current stable release:
>>
Related
I wanted to have a go at Microsoft.ApplicationInsights telemetry. Documentation claims that TelemetryContext is supposed to be in Microsoft.ApplicationInsights.Contracts namespace, however when I grab Application Insights for Web from nuget (it gets me Microsoft.ApplicationInsights as dependency), it does not seem to have Contracts in it.
Microsoft.ApplicationInsights.Contracts nuget search gives no results.
I must be missing something obvious here.
The documentation on MSDN appears to be out of date.
In 1.1 of the Application Insights SDK (the latest, which I'm assuming you are using), has TelemetryContext in this namespace: Microsoft.ApplicationInsights.DataContracts (note DataContracts not just Contracts). I used Resharper to let it find the TelemetryContext class and it found it in this namespace in the core package (Microsoft.ApplicationInsights).
The SDK release notes do not mention anything specifically about this namespace moving however, https://azure.microsoft.com/en-us/documentation/articles/app-insights-release-notes-dotnet/.
API docs now updated. Sorry for the inconvenience, and thanks for pointing this out.
When I try to install IronPython on Debian with Mono (3.12), I get the following error:
socket.cs(1900,63): error CS0117: `System.Net.Sockets.SocketOptionName' does not contain a definition for `IPv6Only'
How can I solve this problem? According to the IronPython website, everything should compile without errors.
In the Mono mailing list there is already such a bug, but there is no answer to this bug. Therefore I thought that maybe this forum is a better place for this question.
I'm no expert on either IronPython or Mono, but out of curiosity I just tried this.
For whatever reason, the IPV6Only value in the SocketOptionName enum appears to be missing in the Mono implementation. The error message you're getting is from the code in IronPython.Module/Socket.cs attempting to reference this. It turns out that this is already recognised in the codebase as a feature that not all platforms have, so there's an easy workaround:
The Common.proj project file in the Solutions/ directory in your git checkout defines a number of possible ReferencedPlatform values. The default value is V4. Just below there in the XML, find a block starting:
<PropertyGroup Condition="'$(ReferencedPlatform)' == 'V4'">
Nested in there is a Features element with a list of the features that apply, and if you find and delete FEATURE_IPV6 at the end of the list, then you should find that the project will build using make. I briefly tried firing up the ipy.exe that is generated and it seems to work.
Obviously this isn't a very good solution. Probably the best thing would be to file a bug report with the IronPython project. I guess that Mono on Linux is probably a fairly low priority for the guys who are working to maintain it.
Correct, up to mono 4.0 throws Protocol option not supported when setting IPv6Only false.
This is probably resolved here: https://github.com/mono/mono/blob/mono-4.2.0-branch/mono/metadata/socket-io.c#L536
But do note the compile flag IPV6_V6ONLY
working with unity and c# and when I try these line
using System.Xml.Linq;
I get this error
The type or namespace name Linq' does not exist in the namespace
System.Xml'. Are you missing an assembly reference?
So I found online, through a lot of searching, that Linq can cause problems, and you need to manually add a reference in MonoDevelop. So I added a reference there (by right clicking References in the solutions pane, clicking Edit References and browsing for System.Xml.Linq)
Still no luck,
Any ideas?
I think this SO post will answer your question...
https://stackoverflow.com/a/875704/1246574
It's pretty much the same issue you're having.
You can't modify the monodevelop (or visual studio) solution or project manually. Because they are generated by Unity. Even if you modify it, Unity can overwrite your changes when it regenerates the solution files.
The reason you can't use some namespaces is the .net/mono version selected in your Unity project settings.
Search for "API Compatibility Level" in this documantation http://docs.unity3d.com/Documentation/Manual/class-PlayerSettings.html
C'mon people, Stop modifying the generated code files. This is 2013!
from this post, I found that Unity doesn't support .NET 3.5 by default (which is required to use Linq). In the settings Xtro talked about, you can only choose .NET 2.0. Instead, you need to drag the desired .dll file into Unity like a texture. Kinda hackish, but it works. Once again, like Xtro said, there is NO REASON to edit the MonoDevelop settings. They have no affect on the final compilation.
EDIT: See Xtro's answer for an alternate solution. He was able to make Linq work by changing the API Compatibility Level to .NET 2.0 (not Subset).
EDIT 2: I just updated from Unity 4.1 to 4.2 today and got an error that Linq was defined twice. by deleting the .dll, I solved the error. Note I'm still using .NET 2.0 Subset. Looks like they added Linq support by default.
output type of 'Class Library', and a target framework of '.NET Framework 4'.
According to everything I've read, I should have it available, but all I'm seeing in the System.Runtime namespace is the following:
CompilerServices
ConstrainedExecution
ExceptionServices
Hosting
InteropServices
Remoting
Serialization
Versioning
Any ideas?
You just need to add a reference to the System.Runtime.Caching assembly.
In solution explorer, right-click on "References"
Select "Add reference"
From left side menu select "Assemblies"
Look for (or filter) and add System.Runtime.Caching.dll.
It's not part of the default set of references in a class library, but you should be able to add it with no problems.
To complement Jon Skeets answer, (for those who run into this problem), if you still get red squiggly lines under Caching after having added reference to System.Runtime.Caching assembly, just restart the Visual Studio, after having saved the solution, and you should be good to go.
Having added the reference, saved the solution and ( if need may be ) restarted Visual Studio, you should be able to use the types within this namespace. In order to get my solution to work, I had to do this very way.
Edit:
While trying to recreate the problem, and solving this way, it seems that we need to set Copy Local to True in System.Runtime.Caching > Properties and then restart Visual Studio for getting it to work. At least, for my case, the problem didn't seem to solve without this. ;)
Reference System.Runtime.Caching.dll. This is another one of those rather obtuse gotchas in the .NET framework right now where there will be very similar namespaces in some things, but the actual classes you want will be referenced in different assembles. As an example, CacheItem is in this alternate DLL, whereas ApplicationActivator (in System.Runtime.Hosting) is in mscorlib.
For me the System.Runtime.Caching NuGet package is what I needed
little bit o this and all was well
dotnet add package System.Runtime.Caching --version 5.0.0
I've referred the file System.Security.dll as described in this article but according to my IDE, the line using System.Security.Cryptography; can be safely removed as it's not being used.
The same IDE tells me that I've got an error with DataProtectionScope and ProtectedData. Those are supposed to be in that namespace. However, when I dot my way through the packages, I can't see them in there.
Is the article wrong? How can I access the two classes?
As #Coral Doe mentioned in a comment under #Dave Lucre:
"Had a similar problem and this worked. using System.Security.Cryptography; didn't [show] me [ProtectedData] and ProtectedMemory until I had referenced the System.Security.dll for the specific framework."
This fixed the issue for me. Specifically, I performed these steps:
Open the project in Visual Studio.
Right-click the project's name in Solution Explorer then choose Properties.
Click the References tab on the left.
Click the Add button.
Click the .NET tab.
Select System.Security and click OK to add the reference.
Hope this helps.
I have referenced the System.Security.dll here: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Security.dll
Added using System.Security.Cryptography; and I can see both DataProtectionScope and ProtectedData.
I'm targeting the .net 4.0 full framework (not client profile).
What framework are you targeting?
I had to add this NuGet package in addition to System.Security.Cryptography.
It is https://www.nuget.org/packages/System.Security.Cryptography.ProtectedData/.
After that, System.Security.Cryptography became "used".
As #Dave Lucre asked, what framework is your application targeting? Visual Studio creates all new applications to use the Client Profile by default (which is asinine in my opinion), and it causes all sorts of trouble if you don't specifically change it back. Give that a look, then see where we go from there.
Remove references System.Security.Cryptography and add it again.
It works in my case.
I'm sorry, I know that this is a quite old post, but I'm having this issue now and the only workaround that I've found is:
Follow the steps mentioned in George Brian's answer
Use System.Security.Cryptography.DataProtectionScope scope = System.Security.Cryptography.DataProtectionScope.LocalMachine; instead of DataProtectionScope scope = DataProtectionScope.LocalMachine;
This might be a slap in your face because you've probably tried that (and you haven't, you might deserve one). What happens if you reinstall the whole IDE? And I meant really the whole thing. Remove the framwork, the VS, remove the files, go paranoid and clean up the trash can, switch to a different installation directory etc. Does the problem still remains?
I know it doesn't explain why it happened but at this stage I'm guessing you're mostly interested in how to kill the problem.
If you have access to a spare computer - why don't you install VS on that machine and see if you can reproduce the error. If not, then there's something fishy with your primary machine and you'll probably never know what happened.
I'm stressing here that it's only a list of general suggestions that every programmer should rely on when nothing sane nor logical seems to work. And yes, I do hate computers. I love programming but I hate computers. They are like small, evil people with keyboards...