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 }}
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.
I created a Framework 4.0 WinForm application, and add OpenNAT by Nuget. And add sample code in Form Load events:
var discoverer = new NatDiscoverer();
var cts = new CancellationTokenSource(10000);
var device = await discoverer.DiscoverDeviceAsync(PortMapper.Upnp, cts);
await device.CreatePortMapAsync(new Mapping(Protocol.Tcp, 1600, 1700, "The mapping name"));
The VS report the following error during compilation.
The type or namespace name 'CancellationTokenSource' could not be found (are you missing a using directive or an assembly reference?)
If I add the reference to System.Threading, it will report another issue:
The type 'CancellationTokenSource' exists in both 'System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
The text was updated successfully, but these errors were encountered:
This issue has nothing to do with Open.NAT.
However, for those reading this, the fix is to put the following in your usings: using CancellationTokenSource = System.Threading.CancellationTokenSource;
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I created a Framework 4.0 WinForm application, and add OpenNAT by Nuget. And add sample code in Form Load events:
The VS report the following error during compilation.
The type or namespace name 'CancellationTokenSource' could not be found (are you missing a using directive or an assembly reference?)
If I add the reference to System.Threading, it will report another issue:
The type 'CancellationTokenSource' exists in both 'System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
The text was updated successfully, but these errors were encountered: