I have an exception stacktrace from xamarin-android release build. There no filenames and line numbers:
System.NullReferenceException: Object reference not set to an instance
of an object
at Test.Foo (Test.Bar bar) <0x995f8000 + 0x00248> in <filename unknown>:0
at ...
Is it possible to find IL code by address (0x995f8000 + 0x00248) in DLL that triggers this exception?
Related
I'm using Unity 2019.3.6f1. I have created a simple DLL for connecting to Azure and uploading a file. However, when I call this DLL to attemp connecting to the Azure blob storage I get the following stack trace:
NotImplementedException: The method or operation is not implemented.
System.Net.Http.HttpClientHandler.get_MaxConnectionsPerServer () (at
<7ebf3529ba0e4558a5fa1bc982aa8605>:0)
Azure.Core.Pipeline.ServicePointHelpers.SetLimits
(System.Net.Http.HttpMessageHandler messageHandler) (at
:0)
Azure.Core.Pipeline.HttpClientTransport.CreateDefaultClient () (at
:0)
Azure.Core.Pipeline.HttpClientTransport..ctor () (at
:0)
Azure.Core.Pipeline.HttpClientTransport..cctor () (at
:0) Rethrow as
TypeInitializationException: The type initializer for
'Azure.Core.Pipeline.HttpClientTransport' threw an exception.
Azure.Core.ClientOptions..ctor () (at
:0)
Azure.Storage.Blobs.BlobClientOptions..ctor
(Azure.Storage.Blobs.BlobClientOptions+ServiceVersion version) (at
:0)
Azure.Storage.Blobs.BlobServiceClient..ctor (System.String
connectionString, Azure.Storage.Blobs.BlobClientOptions options) (at
:0)
Azure.Storage.Blobs.BlobServiceClient..ctor (System.String
connectionString) (at :0)
Cineon.UnityToAzureConnection+d__1.MoveNext () (at
<5252723c79f94a8cb77bb25e3b9f0396>:0)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at
<437ba245d8404784b9fbab9b439ac908>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0
(System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at
:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
Here is my DLL code (in line with this Microsoft quickstart guide):
public class UnityToAzureConnection
{
private readonly static string m_connectionString = "CENSORED";
public static async void CreateConnection(string _path, string _fileName)
{
BlobServiceClient blobServiceClient = new BlobServiceClient(m_connectionString);
BlobContainerClient containerClient = await blobServiceClient.CreateBlobContainerAsync("imagetest");
BlobClient blobClient = containerClient.GetBlobClient(_fileName);
using (FileStream _fs = File.Open(Path.Combine(_path, _fileName), FileMode.Open))
{
await blobClient.UploadAsync(_fs, true);
}
}
}
I simply call this DLL's CreateConnection method and pass in my "Application.dataPath" and a filename. However, I then get the above exception.
I have pulled all other needed DLL's from the project build folder into the plugin folder, so am unsure why this is occuring.
Any assistance would be greatly appreciated.
Please note that I am just starting to move out of my comfort zone here, so I'm hoping that my post is to StackOverflow's standard of questions.
[P.S.] Obviously "CENSORED" isn't my actual connection string, just keeping sensitive info hidden.
UPDATE 29/05/2021 I have confirmed that my connection code DOES work when used in a simple .net console app (however, I did have to adjust the containername to be all lowercase). This error only occurs in Unity. Again, any and all help would be appreciated.
As I mentioned here, try it once.
If you have a lower version of Unity, Azure.Core ver. 1.19.0 may be better.
https://forum.unity.com/threads/attempting-to-connec-to-azure-blobs-results-in-notimplementedexception.1117705/
I have experienced the same exception in BlobServiceClient constructor in my mobile project.
The problem was in the version of Azure.Storage.Blobs package. I used the most recent version 12.12.0, and it caused the exception.
When I downgraded Azure.Storage.Blobs package to 12.9.1 all things worked fine.
Just some background: it was working code in Production since 2013. Recently added DB password encrypt/decrypt logic in code - compiled code using VS2010 - it's working fine in test but not in Production.
I am assuming it has something to do with configuration xml , mapping or some mismatch of NHibernate dll. Not sure if build/output folders need some thing?
Error in Production:
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
NHibernate MappingException: Could not compile the mapping document: (XmlDocument) ---> System.InvalidCastException: [A]NHibernate.Cfg.MappingSchema.HbmMapping cannot be cast to [B]NHibernate.Cfg.MappingSchema.HbmMapping. Type A originates from 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' in the context 'Default' at location 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\drcwm\bb04bdb4\da32eda4\assembly\dl3\bb71f3c5\00f7c13c_ef33d101\NHibernate.dll'. Type B originates from 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' in the context 'LoadFrom' at location 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\drcwm\bb04bdb4\da32eda4\assembly\dl3\44ab434f\00f7c13c_ef33d101\NHibernate.dll'.
at NHibernate.Cfg.XmlHbmBinding.Binder.Deserialize[T](XmlNode node)
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode node)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
at NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc, String name)
at FluentNHibernate.PersistenceModel.Configure(Configuration cfg)
at FluentNHibernate.Cfg.FluentMappingsContainer.Apply(Configuration cfg)
at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
at DB.FIOS_SOUTH.DataBase.get_SessionFactory()
NLog.LoggerImpl.Write Error "System.NullReferenceException: Object reference not set to an instance of an object.
at DB.Base.DataBase.get_Session()
at DB.Base.DataBase.Query[T]()
at RemoteService.BaseListService.FilteredQuery[T](BaseParameter parameter, DataBase db, Boolean applyPagination, Boolean applySortOrder)
at RemoteService.JobsListService.GetJobsWithChildrenCount[T](JobParameter parameter)
Code throwing exception is below:
if (_ISessionFactory == null)
{
try
{
_ISessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005
.ConnectionString(ConnectionString).IsolationLevel(IsolationLevel.ReadUncommitted)
.Cache(c => c.ProviderClass<HashtableCacheProvider>())
)
.Mappings(m =>
{
m.HbmMappings
.AddFromAssemblyOf<FIOS_NORTH_QUEUES.DataBase>();
m.FluentMappings
.AddFromNamespaceOf<FIOS_NORTH_QUEUES.Map.QueueWFADOItemMap>();
})
.ExposeConfiguration(ModifyConfiguration)
.BuildSessionFactory();
}
catch (Exception ex)
{
logger.Error(ex);
}
}
your production process has already loaded NHibernate from an old (shadow-)cache location then the new dlls are loaded from a new location and try to load their dependencies next to them, but since the process already loaded the assemblies from elsewhere it has a conflict.
You have to try unloading/restarting the AppDomain by restarting the server process, asp.net process, iis, whatever. The error is not related to the code at all.
I'm having a issue trying to write input to linux process. Here the code goes:
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.WorkingDirectory = "'/home/"+user+"/pacotes/"+nome_pacote.Text+"-1.0/'";
process.StartInfo.FileName="dh_make";
process.StartInfo.Arguments="-n -s";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.Start();
Thread.Sleep(3000);
process.StandardInput.WriteLine();
And here goes the error:
System.IO.IOException: Write fault on path /home/vinholi/Ubuntu One/Uso do linux em flash drives/Programa gerador de .deb/GeradorDeb/GeradorDeb/bin/Debug/[Unknown]
at System.IO.FileStream.FlushBuffer (System.IO.Stream st) [0x00000] in :0
at System.IO.FileStream.FlushBuffer () [0x00000] in :0
at System.IO.FileStream.Dispose (Boolean disposing) [0x00000] in :0
One likely explanation for this error is that the process exited before you're attempting to write to it. I tried this with /bin/date and a legitimate StartInfo.WorkingDirectory and the assembly is /Workspace/export/misc/H.exe. This yields:
Unhandled Exception:
System.IO.IOException: Write fault on path /Workspace/export/misc/[Unknown]
at System.IO.FileStream.WriteInternal (System.Byte[] src, Int32 offset, Int32 count) [0x00097] in /Workspace/mono/mcs/class/corlib/System.IO/FileStream.cs:658
at System.IO.FileStream.Write (System.Byte[] array, Int32 offset, Int32 count) [0x000aa] in /Workspace/mono/mcs/class/corlib/System.IO/FileStream.cs:634
at System.IO.StreamWriter.FlushBytes () [0x00043] in /Workspace/mono/mcs/class/corlib/System.IO/StreamWriter.cs:222
at System.IO.StreamWriter.FlushCore () [0x00012] in /Workspace/mono/mcs/class/corlib/System.IO/StreamWriter.cs:203
at System.IO.StreamWriter.Write (System.Char[] buffer) [0x00022] in /Workspace/mono/mcs/class/corlib/System.IO/StreamWriter.cs:351
at System.IO.TextWriter.WriteLine () [0x00000] in /Workspace/mono/mcs/class/corlib/System.IO/TextWriter.cs:257
at X.Main () [0x00066] in /Workspace/export/misc/H.cs:17
You are getting this every time when you're using an invalid directory in process.StartInfo.WorkingDirectory. There's nothing that can be done about that, though the error message should be made clearer.
Your directory is invalid because of the quotation marks. You also should not concatenate path names the way you did as it makes your application non-portable to non-Unix operating systems. Instead, write it as:
var home = Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
process.StartInfo.WorkingDirectory = Path.Combine (home, "pacotes", nome_pacote.Text+"-1.0");
Using Environment.GetFolderPath() makes it easier to run your application on a Mac (where home directories are in /Users/<username> instead of /home/<username>).
One other possibility is that the binary that you're launching is a dangling symlink. Check if the binary exists or is a symlink pointing to a valid binary.
As another response stated "One likely explanation for this error is that the process exited before you're attempting to write to it."
And that was the problem I had -- even after setting the WorkingDirectory as described in the other answer. And in your same situation: C#, Mono, Ubuntu.
Ultimately the solution in my case was to set the Arguments so that the process was not exiting, and was really trying to read input from the StandardInput.
The path you are trying to write too can't be written too.
" /home/vinholi/Ubuntu One/Uso do linux em flash drives/Programa gerador de .deb/GeradorDeb/GeradorDeb/bin/Debug/"
Looks like its a usb drive. Check the following:
Its not readonly.
Its not been mounted readonly.
The usb drive is not out of space.
I have a C# ASP.NET application that throws an "Object reference not set to an instance of an object" exception.
The line that throws the exception is
HtmlLink cssTemplate = new HtmlLink();
I am using the cssTemplate variable in my site to set the CSS sheet on my masterpage based on the logged in user.
Any ideas as to why I would get this error on instantiation of the cssTemplate object?
Update: The entire snippet from the exception is
Message: Object reference not set to an instance of an object.
Stack Trace: at LRMasterPage.Page_Load(Object sender, EventArgs e in
LRMasterPage.master.cs:line 49
Target Site: Void Page_Load(System.Object, System.EventArgs)
Data: System.Collections.ListDictionaryInternal
I am wondering now if it is the System.Collections.ListDictionaryInternal that might actually be the issue.
Whenever I try to create a new audio context in monodroid, it fallls over telling me that openal32.dll is missing; which naturally doesn't make sense, being as this is monodroid, and openal is included as part of OpenTK.
I can only assume i'm doing something wrong, but i've used OpenTK/OpenAL before under windows and have managed just fine with similar code.
anyway here is the offending code:
public Audio()
{
if (Loaded == false)
{
Loaded = true;
try
{
try {Console.WriteLine ("Current: " + AudioContext.CurrentContext.ToString());} catch { Console.WriteLine ("no current context"); }
try {Console.WriteLine ("Default: " + AudioContext.DefaultDevice);} catch { Console.WriteLine ("no default device"); }
Context = new AudioContext();
ValidContext = true; //we have a valid audio context!
}
catch (Exception ex)
{
Console.WriteLine ("Loading the audio context failed.");
Console.WriteLine (ex.ToString ());
Console.WriteLine (ex.Message);
ValidContext = false; //Loading the audio context failed :(
}
}
}
And here is the output:
I/monodroid-gc(24762): environment supports jni NewWeakGlobalRef
D/AndroidGameView(24762): SurfaceCreated
D/libEGL (24762): egl.cfg not found, using default config
D/libEGL (24762): loaded /system/lib/egl/libGLES_android.so
I/mono-stdout(24762): no current context
I/mono-stdout(24762): no default device
I/mono-stdout(24762): Loading the audio context failed.
I/mono-stdout(24762): System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Audio.AudioContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Audio.AudioDeviceEnumerator ---> System.DllNotFoundException: openal32.dll
I/mono-stdout(24762): at (wrapper managed-to-native) OpenTK.Audio.OpenAL.Alc:MakeContextCurrent (intptr)
I/mono-stdout(24762): at OpenTK.Audio.OpenAL.Alc.MakeContextCurrent (ContextHandle context) [0x00000] in <filename unknown>:0
I/mono-stdout(24762): at OpenTK.Audio.AudioDeviceEnumerator..cctor () [0x00000] in <filename unknown>:0
I/mono-stdout(24762): --- End of inner exception stack trace ---
I/mono-stdout(24762): at OpenTK.Audio.AudioContext..cctor () [0x00000] in <filename unknown>:0
I/mono-stdout(24762): --- End of inner exception stack trace ---
I/mono-stdout(24762): at Hardware.Audio..ctor () [0x00000] in <filename unknown>:0
I/mono-stdout(24762): An exception was thrown by the type initializer for OpenTK.Audio.AudioContext
I/ARMAssembler(24762): generated scanline__00000177:03545444_00009001_00000000 [159 ipp] (215 ins) at [0x4fc138:0x4fc494] in 4168381 ns
openal32.dll is not included as part of OpenTK. OpenTK just has bindings for OpenAL. Just like opengl32.dll, which is included as part of your graphics card drivers, openal32.dll must be installed through audio card drivers (or a software implementation of it).
After a quick search, it looks like you need to compile a software implementation of OpenAL for Android: http://pielot.org/2010/12/14/openal-on-android/
Edit: It looks like Android prefers to use the newer OpenSL ES. If you've got a bit of time on your hands, you could try to get OpenTK's generator to generate OpenSL ES bindings for you.
This other StackOverflow question has a few other options for using OpenSL.